The latest difference in require include php5 is that Baidu has many errors ., Requirephp5

Source: Internet
Author: User

The latest difference in require include php5 is that Baidu has many errors ., Requirephp5

The error reporting mechanism is different between the two. include indicates that the program continues to be executed by warning. require will report a fatal error and interrupt the program running.

The former has a return value, while the latter does not.

Note that there is no difference in php5. Previously, require is unconditionally included, that is, the file is included regardless of whether the condition is true or not. I also accidentally tested and found out today. There is no such difference.

If you don't believe it, try the following code: code in the. php file

<? Php $ a = '1'; if ($ a) {require ('B. php');} else {require ('C. php');}?>

B. php file code

<? Phpecho "B file";?>

C. php file code

<? Phpecho "c file";?>

Access a. php results

// File B

We can see that require and include are both conditional.

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.