Statements are expressions terminated by semicolons:


A statement in PHP is any expression that is followed by a semicolon (;).Any sequence of valid
PHP statements that is enclosed by the PHP tags is a valid PHP program. Here is a typical
statement  in PHP, which in this case assigns a string of characters to a variable called
$sharda:

<?php
$sharda = "Welcome to Join Sharda Technologies";
echo $sharda;
 ?>

Output:
Welcome to Join Sharda Technologies


Expressions are combinations of tokens: 

The smallest building blocks of PHP are the indivisible tokens, such as numbers (3.14159),
strings (.two.), variables ($two), constants (TRUE), and the special words that make up the
syntax of PHP itself like if, else, while, for and so forth

Braces make blocks:
Although statements cannot be combined like expressions, you can always put a sequence of
statements anywhere a statement can go by enclosing them in a set of curly braces.
<?php
 if (6 == 3 * 2)
{
  print ("Good - I haven't totally lost my mind.<br>");
}
 else
{
print ("print else");
}
 ?>


Output
Good - I haven't totally lost my mind.


No comments:

Post a Comment