What does ' language builder ' mean?

Source: Internet
Author: User
There is a passage in the PHP manual.
"Because it is a language constructor and not a function, it cannot be called by a mutable function. ”
What does the language constructor specifically mean. I don't understand.

Reply content:

There is a passage in the PHP manual.
"Because it is a language constructor and not a function, it cannot be called by a mutable function. ”
What does the language constructor specifically mean. I don't understand.

You mentioned "language constructor", English is "language construct", is the meaning of language composition, translation into the language of the constructor is inevitably a bit confusing. PHP has,,, and echo print die require Several special keywords, although they are used as functions, but in fact more like if , while so control statements, rather than a function. In other words, when the interpreter encounters:

print ' Hello world ';

An expression like this does not convert it into a function call, but instead directly maps to a sequence of predefined operations. You can use parentheses when using the language composition, or without parentheses, but you must use parentheses when using the function.

You refer to the "variable function", the English is "variable function", the meaning of variable function, translated into "variable function" is also a bit distorted the original meaning, the variable (variable) This noun according to the adjective (variable) to translate. The variable function in PHP means that if you add a pair of parentheses after a variable, the interpreter will try to find a function with the same name as the value of the variable, and execute it if it finds it. For example, if you have a function foo() , you can call this function in the following way:

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

So, the implication of the sentence you mentioned is that using a variable function to invoke a language construct is not allowed, such as the following:

$func = ' print ';//This creates an exception because print is not a function, but rather the constituent part of the language $func (' Hello World ');

Executing this code produces an exception, and the function print is undefined.

Finally, it is recommended to read English documents or English-based, Chinese document translation level and update rate is usually compared to the pit father.

  • 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.