RE: [PHP] Require() vs Include()
| From: | Maxim Maletsky | Date: | Wed, 15 Nov 2000 02:52:01 +0000 |
| Subject: | RE: [PHP] Require() vs Include() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-25335@lists.php.net to get a copy of this message | ||
As I already tried to mention in here:
Now (since the PHP4.0.2) require() and include() are working in the EXACTLY
same way.
the only difference remains the premature exit of the file on a failure of
require().
It is what Zeev wrote in his previous email on my thread.
Cheers,
Maxim Maletsky.
-----Original Message-----
From: Myke Hines [mailto:MykeH@WebSite.WS]
Sent: Wednesday, November 15, 2000 3:39 AM
To: php-general@lists.php.net
Subject: RE: [PHP] Require() vs Include()
Wasn't their an issue in using require/includes in classes, if's, whiles, or
something?
One would always be included where as the other would only be included if it
meet the condition it was in. Sorry so vague.
-----Original Message-----
From: Duke Normandin [mailto:01031149@3web.net]
Sent: Tuesday, November 14, 2000 3:21 AM
To: Lars Torben Wilson
Cc: php-general@lists.php.net
Subject: RE: [PHP] Require() vs Include()
On 14 Nov 00 at 11:32, php-general-digest-help@lists wrote:
>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.
Is my paraphrasing correct?
require() is "absolute" -- so don't use it in a conditional statement
because it makes no sense (to me anyway)
require() is "absolute" -- make sure that what you "require" exists where
it's suppose to be, otherwise the script fails "hard".
include() is *not* absolute -- use it in a conditional
include() failures do so "softly" - returns garbage, e.g.
Up to php4.0.1 require() had the edge on speed -- none to very litle with
php4.0.2+.
-duke
Calgary,Alberta, Canada
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net