The difference between PHP language constructs (Language constructs) and functions

Source: Internet
Author: User
The difference between PHP language structure (Language constructs) and functions
I believe you often see a comparison of some PHP applications, said to replace strlen () with Isset (), isset than strlen execution speed and so on. Example:         if (Isset ($username [5])) {                 //The username is at least six characters long.} The reason is that isset is a language structure, and strlen is a function. What is the language structure? Is it different from the function? 1,  What is the language structure and function language structure: is the PHP language keyword, language grammar part; it can not be defined by the user or added to the language extension or library; it can have or can have no variables and return values. Function: Consists    of blocks of code that can be reused. 2, the  reason why the language structure is faster than the function is in PHP, the function must first be decomposed into the language structure of the PHP parser, so there is this visible, the function is more than the language structure of a layer of parser parsing. This makes it better to understand why the language structure is faster than the function. 3, the  language structure and function of the different           language structure than the corresponding function of the function of the fast          language structure is relatively robust in error handling, because it is a language keyword, so there is no re-processing link          language structure can not be disabled in the configuration item (php.ini), function. The          language structure cannot be used as a callback function 4, the  language structure list           echo ()          print (), yes, this is a language structure die          ()          isset (): Only for variable          unset ()          include (), no include_once ()          require (), no require_once ()          array ()          list ()          

Excerpt from: http://blog.sina.com.cn/s/blog_475429950100hk75.html
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.