An introduction to the PHP language constructor
- 2020-07-21 07:21:10
- OfStack
PHP contains several special keywords, such as echo, print, die, require, etc. Although they sound like functions, they are actually more like control statements like if and while than a function. That is, when the interpreter encounters:
print 'Hello world';
Such an expression does not translate into function calls, but maps directly to a series of predefined operations. Languages can be constructed with or without parentheses, but functions must be constructed with parentheses.
variable function is a variable function, which means "variable function". It means "variable function". Variable function in PHP means that if a variable is followed by a pair of parentheses, the interpreter tries to find a function with the same name as the variable's value, and if found, executes it. For example, if you have a function called foo(), you can call it this way:
// Initialize the 1 String variables
$func = 'foo';
// Find the name and the string 1 Function, and execute it
$func();
So, what you mean by that is that it is not allowed to use variable functions to call a language structure in this way, for example:
$func = 'print';
// This creates an exception because print not 1 A function, but a building block of language
$func('hello world');
Executing this code produces an exception, and the function print is not defined.