PHP Syntax

Statement and semicolons in php.
In php, and like most languages, at the end of each php instuction, we must add a semicolon, for example:
<?php
echo "Hello Jack, ";
echo "You are in our member page ! ";
?>
Display :
Hello Jack, You are in our member page !
Comments in php.
To add comments to your php script, we use // for one line comments, or both /* and */ for multiline and large block comments.
<?php
// Here one line comment
echo "Hello Jack, ";

/* Here
large block
comment
*/
echo "You are in our member page ! ";
?>
Spaces in php.
You can as spaces as you want in your php script, this will not affect in anyway your code, and they will not be displayed in your html page, only spaces between " and " or ' and ' will be displayed in your html page.
<?php
echo "Hello Jack, ";
echo "You are in our member page ! ";
?>
This will not make any difference in the page, it will be displayed:
Hello Jack, You are in our member page !
next post: PHP variables.

0 comments: