Both require() and include() are identical in every way except upon
failure, require will shout a Fatal Error while include provides a
Warning.  

Fatal warnings don't allow the code to continue, Warnings don't have such
an affect.

The current include/require docs reflect the status of pre 4.0.2 and is in
the process of being updated.

regards,
Philip Olson

On Tue, 23 Oct 2001, Steve Cayford wrote:

> So both include() and require() *are* subject to conditional statements 
> in the code? Guess I missed that.
> 
> Thanks.
> 
> -Steve
> 
> On Tuesday, October 23, 2001, at 01:00  AM, Rasmus Lerdorf wrote:
> 
> > That's outdated.  The only difference today is that if a file can't be
> > included/required for some reason it is a fatal error with require and a
> > warning with include.
> >
> > -Rasmus
> >
> > On Tue, 23 Oct 2001, Jason G. wrote:
> >
> >>  From the manual:
> >>
> >> 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.
> >>
> >> Similarly, looping structures do not affect the behaviour of require().
> >> Although the code contained in the target file is still subject to the
> >> loop, the require() itself happens only once.
> >>
> >>
> >>
> >>
> >>
> >> At 08:48 AM 10/23/2001 +0900, Yasuo Ohgaki wrote:
> >>> Jtjohnston wrote:
> >>>
> >>>> Coverting from perl ...
> >>>> What's the differencw between require and include? Where, when, why?
> >>>
> >>>
> >>> I forgot from which version, but current PHP's require/include works 
> >>> the
> >>> same way except
> >>>
> >>> - require() raise fatal error, if it can't find file
> >>> - include() raise warning, if it can't find file
> >>>
> >>>
> >>> requrie_once()/include_once() works almost the same as 
> >>> require()/include()
> >>> except they include file only once. (Hash table is used to determine 
> >>> if
> >>> files are included or not)
> >>>
> >>> See also get_{required|included}_files()
> >>>
> >>> --
> >>> Yasuo Ohgaki
> >>>
> >>>
> >>> --
> >>> PHP General Mailing List (http://www.php.net/)
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>> To contact the list administrators, e-mail: php-list-
> >>> [EMAIL PROTECTED]
> >>>
> >>
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to