- Basic common sense:
- ?> can be omitted
- The string concatenator is.
- Note //
- Variables
- The first letter of the variable must be $, starting with a letter or underscore "_"
It can only be composed of letters, numbers, and "_", and can also contain Chinese characters
Case-sensitive
- The "var_dump" function can display the data type of our variables, and it has line breaks
- When we use the "echo" command to output the Boolean type, if it is "true", the output is "1", "false" will output nothing
- When a variable is contained in double quotes, the variable will be connected with the content in the double quotes;
When a variable is enclosed in single quotes, the variable will be output as a string
- long string: delimiter <<< + any identifier + content + identifier
- constant
- define definition
- System constants
(1)__FILE__
: PHP program file name. It can help us get the physical location of the current file on the server.
(2)__LINE__
: The number of lines in the PHP program file. It can tell us which line the current code is on.
(3) PHP_VERSION: The version number of the current parser. It can tell us the version number of the current PHP parser, and we can know in advance whether our PHP code can be parsed by the PHP parser.
(4) PHP_OS: The name of the operating system that executes the current PHP version. It can tell us the name of the operating system used by the server, and we can optimize our code according to the operating system - Constant value
- Use the constant name directly
- mixed constant(string constant_name);//Return a variety of information, failure Return error message
- bool defined(string constants_name); Determine whether the variable is defined
- Reference of variable &
- String concatenation operator
- .
- .=//Connection with assignment
- Structural statements
(1) Only take the value, do not remove the subscript
<br>
<?php <br>
foreach (array as value){ <br>
//Tasks to be executed <br>
} <br>
?> <br><br>
(2) Remove the subscript and value at the same time <br><code><br>
<?php <br>
foreach (array as subscript => value){ <br>
//Tasks to be executed <br>
} <br>
?> <br>
').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i ').text(i));
};
$numbering.fadeIn(1700);
});
});
The above has introduced the basics of getting started with PHP, variables, constants, and structural statements, including all aspects. I hope it will be helpful to friends who are interested in PHP tutorials.