PHP code begins with <?php, ends with?>, and can be placed anywhere in the document
Note PHP also allows the use of short mark < And, but not encouraged to use. Short marks can be used only by activating the Short_open_tag configuration directive in php.ini or by using the configuration option--enable-short-tags when compiling PHP
Each PHP statement is separated by a semicolon (;) end, and the close tag of the PHP block automatically indicates the semicolon. The easiest mistake to make in PHP programming is to forget to add a semicolon, which causes PHP to think of a multiline statement as a statement, which makes PHP unintelligible, and the system gives a "parse error" message
PHP supports three types of annotations, including two single-line comments and one multiline comment
[note] comments cannot be nested
<?php//This is a single-line comment # This is also a single-line comment/* This is a multiline comment block which spans multiple lines */?>
In PHP, there are two basic output methods: Echo and Print
Print can output only one string, and always returns 1
Echo is capable of outputting more than one string, and echo is slightly faster than print because it does not return any value
[Note that both]echo and print are language structures, with either echo or Echo (), as well as print or print (), with or without parentheses, and at least one space between the echo or print keyword and the string
Calculation expressions can be written in PHP
<?php //36 echo 12*3;? >
In PHP, all user-defined functions, classes, and keywords are case insensitive, but all variables are case-insensitive
[note]. The number represents a string connection, in other programming languages, usually with the + sign
In general, whitespace characters (including spaces, tab tabs, line breaks) do not matter in PHP and are ignored by the PHP engine. You can expand a statement into any row, or tighten the statement together,
It can enhance the clarity and readability of program code by using space and blank line rationally.
PHP Basic Syntax