Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
March 25, 2005, 4:50 pm
rate this thread
Re: When should I use REQUIRE and when should I use INCLUDE?
Not much of a difference really. The fact that we have both is entirely
historical. In PHP 3, require's are evaluated as the file is parsed. Code in
a require'ed file is linked into the running script even if it's never
executed. The following, for example, would throw an fatal error:
Include's on the other hand occur at runtime, so the above fragment, with
include in place of require, would work as intended.
Starting with PHP 4, require's occur at runtime too. The only difference
remaining between the two is the type of error emitted as others have
I personally use require almost exclusively.
- » "please enter the code as you see in the image" - how does it work?
- — Previous thread in » PHP Scripting Forum