About PHP Language Builder introduction

Source: Internet
Author: User
Tags php language

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:

Copy Code code as follows:
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:

Copy Code code as follows:
Initialization of a string variable
$func = ' Foo ';

Find the name and the same function as 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:

Copy Code code as follows:
$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.