The front-end learns the basic PHP syntax and the front-end php syntax. Basic PHP syntax for front-end learning, front-end php syntax Directory [1] code identification [2] comment [3] output [4] Computing expression [5] Before case sensitivity PHP is a powerful front-end for creating dynamic interactive sites learn the basic syntax of PHP, front-end php syntax
Directory [1] code identifier [2] comment [3] output [4] Computing expression [5] Before case sensitivity
PHP is a powerful server-side scripting language for creating dynamic and interactive sites. PHP can contain text, HTML, CSS, and PHP code. it is executed on the server and the result is returned to the browser in plain text.
Code ID
PHP code And can be placed anywhere in the document.
The PHP statement ends with a semicolon (;). The close tag of the PHP code block automatically indicates a semicolon.
Note
PHP supports three annotations, including two single-line annotations and one multi-line annotation.
Output
In PHP, there are two basic output methods: echo and print
Print can only output one string, and always returns 1
Echo can output more than one string. echo is faster than print because it does not return any value.
[Note] echo and print are both Language Structures. echo or echo () and print or print () can be used with or without parentheses (), there must be at least one space between the echo or print keyword and the string.
"; echo "I'm about to learn PHP!
"; echo "This", " string", " was", " made", " with multiple parameters.";?>
"; Print" I'm about to learn PHP!
"; // This row has an error because print can only output one string: print" This "," string "," was "," made "," with multiple parameters. ";?>
Calculation expression
Unlike HTML and CSS, you can write computation expressions in PHP.
Case sensitivity
In PHP, all user-defined functions, classes, and keywords are case-insensitive, but all variables are case-sensitive.
"; //Hello World! echo "Hello World!
"; //Hello World! EcHo "Hello World!
";?>
[Note] "." indicates a string connection. in other programming languages, "+" is generally used.
"; //My house is echo "My house is " . $COLOR . "
"; //My boat is echo "My boat is " . $coLOR . "
";?>
The examples Directory [1] code identification [2] comment [3] output [4] Computing expression [5] Before case sensitivity, PHP is a powerful way to create dynamic interactive sites...