The syntax structure of a programming language (lexical structure) is a collection of basic rules that govern how to write programs in a language.
The syntax structure is the lowest-level language syntax, and it's what the variable names look like, what characters are commonly used as annotations, and how to separate program statements.
PHP basic Syntax Structure 1, case
As with built-in structures and keywords (such as echo, while, class, and so on), user-defined class names and function names are case insensitive.
Therefore, the following three lines are equivalent:
echo "Hello,world";
ECHO "Hello,world";
EcHo "Hello, World";
On the other hand, variables are size-sensitive. This means that $name, $NAME, and $name are three different variables.
PHP basic Syntax structure 2, semicolon
PHP uses semicolons to separate simple statements. Compound statements use curly braces to mark blocks of code, such as conditional tests or loops, and do not use semicolons after curly braces. Unlike other languages, a semicolon before the closing parenthesis (?>) in PHP is not required.
PHP basic Syntax Structure 3, whitespace, and line breaks
In general, whitespace characters do not matter in PHP. You can expand a statement to any row, or tighten the statement to a single line. You can use this flexible format to make your code more readable (by arranging allocations, indenting, and so on). It is not recommended that some lazy programmers use this free format to create code that cannot be read at all.
PHP basic Syntax Structure 4, program annotations
For the person reading the code, the comment is actually the equivalent of the code's explanation and description. Annotations can be used to explain the purpose of the script, the script writer, why to write code in such a way, the time of the last modification, and so on.
PHP supports C, C + + and Shell script style annotations, as follows:
Single-line Comment
/* */Multiline Comment (Note: cannot be nested)
# Script Comments
http://www.bkjia.com/PHPjc/446008.html www.bkjia.com true http://www.bkjia.com/PHPjc/446008.html techarticle The syntax structure of a programming language (lexical structure) is a collection of basic rules that govern how to write programs in a language. The syntax structure is the lowest-level language syntax, and the variable name is set ...