> Online tutorial : Writing Statements and Comments in php
Showing posts with label Writing Statements and Comments in php. Show all posts
Showing posts with label Writing Statements and Comments in php. Show all posts

Writing Statements and Comments in php


Writing Statements and Comments


As you can see from the previous example, a PHP script consists of one or more
statements, with each statement ending in a semicolon. Blank lines within the
script are ignored by the parser. Everything outside the tags is also ignored by the
parser, and returned as is; only the code between the tags is read and executed.

TIPS

If you’re in a hurry, you can omit the semicolon on the last line of a PHP
block, because the closing ?> includes an implicit semicolon. Therefore,
the line is<?php echo 'Hello' ?>  perfectly valid PHP code.
This is the only time a PHP statement not ending in a semicolon is still
considered valid.
For greater readability, you should add comments to your PHP code, as I did in
the previous example. To do this, simply use one of the Comments styles listed here:


<?php


// this is a single-line comment

# so is this

/* and this is a

multiline

comment */

?>