RE: [PHP] Require() vs Include()

From: Date: Tue, 14 Nov 2000 06:05:45 +0000
Subject: RE: [PHP] Require() vs Include()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25128@lists.php.net to get a copy of this message
Maxim Maletsky writes: > OK, then. > > what is the reason require() exists? > > > If it works the exactly same way as include() except that include can be > more flexible why would we use require() then? > > Any performance issues? > usability? > security? > > Thanks Lawrence, In PHP 3, it was quite a bit faster than include(). There were other semantic differences between the two as well, such as return values etc. Performance appears to now be pretty much the same; you can return values with include() now, and so forth and so on. BTW, require() will fail in a completely different way from include() when it can't find the target file. include() will simply return a false value, whereas require() will spit out a great big 'Fatal error' and halt script execution. -- +----------------------------------------------------------------+ |Torben Wilson <torben@php.net> Netmill iTech| |http://www.coastnet.com/~torben http://www.netmill.fi| |Ph: 1 250 383-9735 torben@netmill.fi| +----------------------------------------------------------------+

« previous php.general (#25128) next »