Declaration : Rules

  • PHP is a loosely typed language and we don't have to define the data-types.
  • The variables must follow "$" sign, and must be a character to begin with.
    • $a = 123;
    • $b ="could be a string";
    • $_123 ="is OK";
    • $123 is wrong.

Code

<?php $test = 1;
notvalid = 1 + 1 ;
5alsobad = "This line prints ";

//This line won't read
echo "Hello World<br>";
$a ="<b>". $test." and Manas<br></b>" ;
echo $a.;
?>

Runtime View