Home >Backend Development >PHP Tutorial >Detailed explanation of PHP language constructor
1. What is the language structure
#Language structure: It is the keyword of the PHP language and part of the language grammar; it cannot be defined or added by the user into a language extension or library; it may or may not have variables and return values.
2. The reason for the fast execution speed of language structure
Functions must first be decomposed into language structures by the PHP parser (Zend engine). Therefore, functions have one more layer of parser analysis than language structures, and the speed is relatively slow. What are the language structures in
3.php
echo() exit()print() die() isset() unset() include(), note, include_once( ) is the function require(). Note that require_once() is the function array() list() empty()
4. How to judge whether it is a language structure or a function
Use function_exists
eg:
function check($name){ if(function_exists($name)){ echo $name.'为函数'; }else{ echo $name.'为语言结构'; } }
5. The difference between language structures and functions
1. Language structures are faster than corresponding functions
2. Language structures are better in error handling Directly, because it is a language keyword, there is no reprocessing step
3. The language structure cannot be disabled in the configuration item (php.ini), but the function can.
4. Language structures cannot be used as callback functions
Remarks:
How to disable functions in php.ini?
Find disable_functions =
Add the function name after equal to, use, to separate multiple function names
For example
disable_functions =
exec,passthru,popen,proc_open,shell_exec,system ,chgrp,chmod,chown
Related recommendations:
About PHP language constructor introduction_PHP tutorial
About the introduction of PHP language constructor
About the introduction of PHP language constructor_php skills
The above is the detailed content of Detailed explanation of PHP language constructor. For more information, please follow other related articles on the PHP Chinese website!