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