In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail what are the differences between language structures and functions in php. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Differences: 1, the language structure is faster than the corresponding function; 2, the language structure can not be disabled in the configuration file "php.ini", and the function can be disabled; 3, the language structure can not be used as a callback function, and the function can.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
I believe you often see that compared with some PHP applications, it is said that using isset () to replace strlen (), isset is faster than strlen and so on.
Example:
If (isset ($user)) {/ / do some thing}
The reason is that isset is a language structure and strlen is a function. So what is the language structure? Is it any different from a function?
1. What are language structures and functions
Language structure: it is the keyword of the PHP language, part of the language syntax; it cannot be defined by the user or added to the language extension or library; it may or may not have variables and return values.
Function: composed of code blocks, can be reused. From the source point of view, that is, based on the basis of the Zend engine to achieve, ext extension library functions are implemented in this way.
2. Why the language structure is faster than the function
The reason is that in PHP, functions are first decomposed into language structures by PHP parsers (Zend engines), so it can be seen that functions have one more layer of parser parsing than language structures. In this way, we can better understand what language structure is faster than function.
3. Differences in language structures and functions.
(1) the language structure is faster than the corresponding function.
(2) the language structure is relatively rough in error handling, and because it is a language keyword, it does not have the link of reprocessing.
(3) the language structure cannot be disabled in the configuration item (php.ini), but the function can.
(4) language structure cannot be used as callback function.
Complement: list of language structures:
Echo () print () die () isset () unset () include () array () list () empty () require ()
Note that include_once () is a function and require_once () is a function
This is the end of the article on "what are the differences between language structures and functions in php". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.