PHP4 the difference between a load statement

Source: Internet
Author: User

The difference between 4 load statements The difference between include and require :

Include loading the file fails (that is, the file is not found), report a "prompt error", and then continue to execute the subsequent code;

Requre The file fails to load, an error occurs and the execution is immediately terminated.

Typically,require is used in programs where subsequent code depends on the loaded file.

The difference between include_once and require_once :

differences from include and require :

The difference between include and include_once :

Include loaded files do not determine whether to repeat, as long as there is an include statement, will be loaded once-that is, it may cause a duplicate loading.

Include_once loaded files will have an internal judging mechanism whether the "previous code" has been loaded, and if loaded, no longer loaded.

The difference between require and require_once :

Differences with include and include_once .

The function of The return statement in the loaded file

1, a load statement, if the load succeeds, there is actually a return value of 1, if the load fails, then the return is false.

(although we usually do not use the return value).

However, if there is a return statement loaded into the file , there is another mechanism and effect at this point:

2,thereturn statement at this point is to terminate the loading process-the return statement's subsequent loaded file code is no longer loaded.

The result of the operation is:

3, The return statement can also be used to return a data when loading a file in the form:return XX data;

The result of the operation is:

PHP4 the difference between a load statement

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.