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’.
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).
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:
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:
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok