1. What is PHP?
- PHP is a cross-platform running on the server side (PHP is used to handle server-side data) (can be run on multiple platforms, such as Linux,windows,unix ...) scripting language (and a line of computer instructions is used to communicate with the server, and the language of communication is PHP).
Code identification for 2.PHP
- <?php?>, you can embed the PHP language in any location in an HTML file that will be named. PHP at a later time.
Print a string (output statement) in 3.PHP
Answer:Echo
4. Instruction delimiter "semicolon"
- Directives: statements in a program that perform certain functions, called Directives .
PHP needs to end with a semicolon after each instruction.
5.PHP Program Notes
Single-line Comment://or #
Note: Note that the comment must be written on or to the right of the commented code, and not written under the code.
Calculation Expressions in 6.PHP
- PHP differs from HTML and CSS in that it can be computed
Example: <?php echo 12*3;?>
String in 7.PHP
A: single quotes: PHP does not parse the variables inside the single quotes, and the variables are output as-is. Using single quotes is more efficient when defining simple strings.
Double quotation marks: the variables inside the double-quoted string are substituted by the value of the variable.
String operators (connectors) in 8.PHP
Example: <?php echo "Hello". ", Hi";?>
Variables in the 9.PHP
- Variables: variables are shipped to store values.
- Declaration: Use the " $ " sign followed by the variable name
10. Naming of variables
- The composition of a variable: a letter, an underscore, a letter, a number, an underscore, and a Chinese character.
- Note: variable names are strictly size-sensitive.
11. Variable variable
12. Assigning a reference to a variable
- Use the "&" symbol to add the & symbol to the variable that will be assigned
PHP Basic Syntax