1. PHP grammar rules?
1) Since we have configured the php file extension. php in the master configuration file for Apache, all PHP files have the extension. php;
2) PHP files must be accessed through the domain name, PHP files can not contain Chinese;
3) PHP must have '; ' after each statement;
4) Variables in PHP must be case-sensitive, the remaining functions, method names, class names are not case-sensitive, but the recommendations are differentiated;
2. PHP tags?
1) Standard format: <?php.....code?> also called XML format;
2) script format: <script language= "PHP" > Echo data (' y-m-d h:i:s '); </script>
3) Short format: <? Code ...? > Default server is not configured in this format, you need to manually configure the php.ini file to open the short format
3. Variables and operations?
Programming language is the operation of memory (read and write to memory)
4. What is the name of the variable?
1) Syntax: $ variable name = value;
2) Description: The variables in PHP must start with the ' $ ' sign;
Variable names can only contain letters, numbers, underscores, and can only start with letters and underscores;
3) If it is a pure PHP code file,?> this terminator tag suggested omitted, if there are other languages in this file, you must add the end tag, not omitted, otherwise error;
4) Define the variable: $v 1 = 1; Definition $v 1 = 10; Change the value of a variable
5) Delete the variable (destroy the variable from memory): unset ($v 1); If the variable is not defined, the output of this variable with ECHO will also report an error, and the variable undefined is undefined;
5. Variable variable?
1) For example: Define a variable $v = age; $age = 20; The output echo $v; Age if output echo $ $v; 20
2) function of variable variables: 1. Access another variable by one variable; (the example above is to access the $age variable via $v).
2. Create another variable with one variable;
3) Code output value is 10, principle such as;
PHP Basic Syntax