PHP Intro and Few Examples – The News Caravan

What is PHP ?

PHP Stands For Hyper Text Pre-Processor, is a Server Side Scripting Language Which is Used Widely Across Different Sites as A Backend Language.

PHP is a very Popular Language and is used to handle the backend logic, Connecting with Databases, and handling Html Forms and Actions Dynamically.

PHP Syntax ?

PHP is a much closer to base languages in terms of code written like c++ etc.

<?php
//This is A Comment and is ignored While Execution 

/* This is a Multi-line Comment
and is Also Ignored While Compiling/Execution */

//Creating A Simple Variable in PHP

$var_name = 1;

//String Example

$name = "Aioexperts";

//creating hello world function

function sayHelloWorld(){

 echo "Hello, World " . "<br>";
  

}

//calling the Above Function

sayHelloWorld();

//creating function with parameters / Non Returning

function print_name($n){
 $name = $n;
 echo $name . "<br>"


}


//calling above print_name function

print_name("Azakios");

?>

Leave a Comment