The PHP syntax and semantics are based on most other programming languages i.e. C, Java, Perl. Also that all PHP code is contained with a tag, of sorts.
Canonical PHP Tags:
The script starts with <?php and ends with ?>. These tags are also called ‘Canonical PHP tags’. Every PHP command ends with a semi-colon (;).
The script starts with <? and ends with ?>. These are the shortest option to initialize a PHP code. This will only work by setting the short_open_tag setting in php.ini file to ‘on’.
ASP Style Tags:
These script starts with <% and ends with %>.
HTML Script Tags:
The HTML script tag syntax is removed in PHP 7.0.0. so its no more used. It is implemented using script tags.
A comment is simply text that is ignored or not executed by the PHP engine. The purpose of comments is to make the code more readable. It may help other developer or it may be useful to yourself if you need to edit the source code to understand what you were trying to do with the PHP.
PHP supports two types of comment are as follows:
Single Line Comments:
There are two types to use single-line comments in PHP. The first one is by using // and the second is # (Unix Shell-style single line comment).
Multiple line Comments:
To write multi-line comments, start the comment with a slash followed by an asterisk (/*) and end the comment with an asterisk followed by a slash (*/), are as follows:
Case Sensitivity in PHP:
All the functions, keywords, and class names in PHP (while, if, echo etc) are NOT case-sensitive. But only variables are case-sensitive with different cases are treated differently. Following example shows the difference: