Alex Rivera | Logout

What is the difference between require and include with php?

Asked 2009-02-27T19:07:29.273
9

I want to know when I should use include or require and what's the advantage of each one.

Edit
Report

1 Answer

0

Per http://www.alt-php-faq.org/local/78/:

Unlike include(), require() will always read in the target file, even if the line it's on never executes. If you want to conditionally include a file, use include(). The conditional statement won't affect the require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed.

answered 2009-02-27T19:10:26.927

Your Answer