The difference between echo, print, print_r, var_dump
Echo and print are language structures, print_r and var_dump are ordinary functions
echo: output one or more strings
print: output string
print_r: Print easy-to-understand information about variables
var_dump: Print easy-to-understand information about variables (with type)
The difference between single quotes and double quotes
Double quotes can be parsed by the analyzer, but single quotes cannot
The difference between isset and empty
isset: check whether the variable has been set and is not NULL
empty: judge whether the variable is empty, if the variable is 0/false, it will be considered empty; if the variable does not exist, no warning will be generated
The difference between static, self, and $this
static: static can be used in static or non-static methods, and can also access static properties, static methods, constants and non-static methods of the class, but not non-static properties
self: can be used to access the static properties, static methods and constants of the class, but self refers to the class where the current definition is located, which is a limitation of self
$this: refers to the object at the time of the actual call, that is to say, who calls the property or method of the class in the actual running process, which object is pointed to by $this. But $this cannot access static properties and constants of the class, and $this cannot exist in static methods
include、require、include_once、require_once 的区别
require and include are almost identical, except for the way they handle failures. require generates an E_COMPILE_ERROR level error when an error occurs. In other words, the script will be aborted and the include will only generate a warning (E_WARNING), and the script will continue to run
The include_once statement includes and runs the specified file during script execution. This behavior is similar to the include statement, the only difference is that if the file has already been included, it will not be included again. As the name of this sentence implies, it will only be included once
Predefined variables||Super global variables — built-in variables that are always available in all scopes
$GLOBALS — reference all variables available in the global scope $_SERVER — server and execution environment information $_GET — HTTP GET variable $_POST — HTTP POST variable $_FILES — HTTP file upload variable $_REQUEST — HTTP Request variable $_SESSION — Session variable $_ENV — environment variable $_COOKIE — HTTP Cookies