: This article mainly introduces the basic syntax-PHP manual notes. For more information about PHP tutorials, see. PHP tag
If the file content is pure PHP code, it is best to delete the PHP end mark at the end of the file. This avoids accidental addition of spaces or line breaks after the PHP end mark, which may cause PHP to start to output these spaces, but the script does not have the intention to output at this time. Of course PHP start marking The leading space or line break will still be output.
Use conditional Advanced Separation
The following code is easy to understand. The key is the use of if-else, which makes the explicit logic clearer in text output.
This will show if the expression is true. Otherwise this will show.
Command separator
PHP needs to end the instruction with a semicolon after each statement. this semicolon is called the instruction separator. You can end the last line in a PHP code snippet without a semicolon.
Note
PHP supports comments in C, C ++, and Unix Shell (Perl style), that is/**/
,//
,#
.
A single-line comment is only commented to the end of the line or the current PHP code block, which means that// ... ?>
Or# ... ?>
The subsequent HTML code will be displayed. However,《script》
Marking in a single line comment does not jump out of the PHP mode.
(Full text)
The above introduces the basic syntax-PHP manual notes, including the content, and hope to be helpful to friends who are interested in PHP tutorials.