Introduction to PHP Constructor

Source: Internet
Author: User
The "language construct" you mentioned is "languageconstruct" in English. It is the meaning of language composition. It is a bit confusing to translate it into a language constructor.

The "language construct" you mentioned is "language construct" in English. It is a bit confusing to translate it into a language constructor.

PHP contains several special keywords, such as echo, print, die, and require. Although they are used as functions, they are actually similar to control statements like if and while, rather than a function. That is, when the interpreter encounters:

The Code is as follows:


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 the language structure, you can add brackets, Hong Kong virtual host, or no brackets, but you must add brackets when using functions.

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, if there is a function foo (), you can use the following method to call this function:

The Code is as follows:


// 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. The American space is as follows:

The Code is as follows:


$ Func = 'print ';

// This will cause an exception because print is not a function but a component of the language.
$ Func ('Hello World ');

When you run this code, an exception occurs. The Hong Kong server is rented and the function print is not defined.

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.