C Language Structure function: The difference between PHP's language structure and function

Source: Internet
Author: User
Tags error handling functions php language strlen zend

I believe you often see comparison of some PHP applications, said with Isset () to replace strlen (), isset faster than strlen execution speed.
Example:
if (Isset ($user)) {
Do some thing
}
The reason is that isset is a language structure, and strlen is a function. And Echo is a language structure, not a function.
What is the language structure? Is it different from a function?
1. What is language structure and function
Language structure: Is the keyword of PHP language, part of language grammar; it cannot be defined by the user or added to a language extension or library; it can have or can have no 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 expansion Library functions are implemented in this way.
2, the language structure is faster than the function reason is in PHP, the function is first by the PHP parser (Zend Engine) decomposed into language structure, so there is this visible, function than the language structure of more than a layer of parser parsing. In this way, we can better understand what language structure is faster than the function.
3, language structure and function of different language structure than the corresponding function of the fast language structure in the error handling is relatively robust, because it is a language keyword, so do not have the process of reprocessing language structure can not be disabled in configuration items (php.ini), the function can be. Language structures cannot be used as callback functions
4, Language structure list
Echo ()
Print ()
Die ()
Isset ()
Unset ()
Include (), note that include_once () is a function
Require (), note that require_once () is a function
Array ()
List ()
Empty () This article links http://www.cxybl.com/html/wlbc/Php/20130326/37403.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.