Difference between function construction and function construction in PHP

Source: Internet
Author: User
The difference between the PHP language structure (Languageconstructs) and functions is often seen in comparison with some PHP applications, that is, replacing strlen () with isset () and faster execution of isset than strlen. Example: if (isset ($ username [5]) {Theusernameis PHP Language structure (Language constructs) and function differences
I believe we often see some PHP applications that use isset () to replace strlen (), and isset to execute faster than strlen. Example: if (isset ($ username [5]) {// The username is at least six characters long.} is because isset is a language structure, and strlen is a function. What is the language structure? Is it different from a function? 1. what is the language structure and function language structure? it is a keyword of the PHP language and part of the language syntax. it cannot be defined or added to language extensions or libraries; it can have or has no variables or return values. Function: it consists of code blocks and can be reused. 2. Why is the language structure faster than functions? in PHP, functions are first decomposed into language structures by the PHP parser, functions have a higher parser than the language structure. In this way, we can better understand why the language structure is faster than the function. 3. different language structures of language structures and functions are faster than those of corresponding functions. the language structure is relatively robust in error handling, because it is a language keyword, therefore, the language structure that does not have the re-processing link cannot be used 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 used for the variable unset () include (), no include_once () require (), no require_once () array () list () empty (): only used in the following cases of variables, isset () returns TRUE: $ var = ""; $ var = array (); $ var = 0; $ var = false; so far: the value is null or not passed. we recommend that you use empty

From: http://blog.sina.com.cn/s/blog_475429950100hk75.html

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.