What does 'language constructor 'mean?

Source: Internet
Author: User
This section is in the php manual. "Because it is a language constructor rather than a function, it cannot be called by variable functions ." What does a language constructor mean. I don't quite understand this section in the php manual.
"Because it is a language constructor rather than a function, it cannot be called by variable functions ."
What does the language constructor mean. Not very clear

Reply content:

This section is in the php manual.
"Because it is a language constructor rather than a function, it cannot be called by variable functions ."
What does the language constructor mean. Not very clear

The "language construct" you mentioned is "language construct" in English. It is the meaning of a language. It is difficult to translate it into a language constructor. PHP hasecho,print,die,requireAnd so on. Although they are used as functions, they are more similarif,whileIn this way, the control statement is not a function. That is, when the interpreter encounters:

print 'Hello world';

In such an expression, it is not converted into a function call, but directly mapped to a series of pre-defined operations. When using a language, you can add parentheses or do not add parentheses, but you must add parentheses when using a function.

The variable function you mentioned is "variable function". translating it into a variable function is also a little distorted) the term is translated according to the meaning of the adjective (variable. The Variable function in PHP is a function with the same name and value as the Variable if a pair of parentheses is added to the Variable. If the Variable is found, the interpreter tries to execute it. For example, there is a functionfoo()You can call this function in the following way:

// Initialize a string variable $ func = 'foo'; // find the function with the same name as this string and execute it $ func ();

Therefore, the meaning of the sentence you mentioned is that using a variable function to call a language is not allowed. For example:

$ Func = 'print '; // This operation produces an exception, because print is not a function, but a component of the language $ func ('Hello World ');

When this code is executed, an exception occurs.printNot defined.

Finally, we recommend that you read English documents mainly in English. The translation level and update speed of Chinese documents are usually poor.

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.