Phprequire condition reference

Source: Internet
Author: User
The phprequire condition reference problem is shown on the Internet.
The include () and require () functions are the same, but their usage is somewhat different. include () is a conditional include function, while require () is an unconditional include function.
Regardless of the value of $ something, the following code includes the file somefile. php into the file:
If ($ something) {require 'somefile. php ';}

However, in my actual test, when the condition is false, it is not included.

The reason is that the environment is different. please advise.


Reply to discussion (solution)

What you see is an introduction to php4
In php5, both require and include are loaded during pre-compilation (invisible when not in use)
The difference between the two is that the former will interrupt the program when an error occurs, while the latter will not

This is obviously wrong. at least in the current version, if (false) {} will not execute the if code block at all.

$ Something = 0 or equal to null. you can see whether it will be introduced.

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.