About the PHP language builder

Source: Internet
Author: User
Tags php language variable

You mentioned "Language builder", English is "language construct", is the meaning of language composition, translation into a language builder is inevitably a bit confusing. PHP has several special keywords, such as echo, print, die, require, and so on, although they work like functions, they are actually more like if, while such as control statements, rather than a function. In other words, when the interpreter encounters:

print ' Hello world ';
When such an expression is not converted into a function call, it maps directly to a series of predefined operations. You can use the language composition with parentheses or without parentheses, but you must use parentheses when using a function.

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

1 2 3 4 5 Initializes a string variable $func = ' foo '; Find the same function as the name and the string, and execute it $func ();

So, the meaning of the sentence you mentioned is that it is not permissible to invoke a language composition in this way by using a variable function, such as the following:

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

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



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.