RE: [PHP] Require() vs Include() - - c o n c l u s i o n

From: Date: Tue, 14 Nov 2000 09:10:03 +0000
Subject: RE: [PHP] Require() vs Include() - - c o n c l u s i o n
Groups: php.general 
Request: Send a blank email to php-general+get-25161@lists.php.net to get a copy of this message
This is great, Thanks Zeev, How come I read it all about 4.0.3 and never found anything saying that the require() function was modified? Can you tell me if it was documented somewhere? Cheers Maxim Maletsky -----Original Message----- From: Zeev Suraski [mailto:zeev@zend.com] Sent: Tuesday, November 14, 2000 6:07 PM To: Maxim Maletsky Cc: php-general@lists.php.net Subject: RE: [PHP] Require() vs Include() - - c o n c l u s i o n At 10:39 14-11-00, Maxim Maletsky wrote: > >As of PHP 4.0.3, the implementation of require() no longer behaves that > >way, and processes the file 'just in time'. That means that in the 1st > >example, the file will be processed a hundred times, and in the 2nd > >example, it won't be processed at all. That's the way include() behaves > >(in all versions of PHP) as well. > >was this implemented since 4.0.3 ? >so require() is now even closer to include() then never. > >my point was to understand when is best to use require(); >and it seems that the only thing to think now is whether we want to exit the >file on failure or not, right? > >q2: did I understand you well: > >if($var) { include(file.php) } >if($var) { require(file.php) } > >will both work if $var is assigned and will get skipped if $var is empty? >(I never tested it, haven't got this into my mind and plus haven't upgrade >my machines from 4.0.2 yet) That's right. The 2nd line will also terminate the execution of the script if $var is set, and file.php cannot be found. Zeev -- Zeev Suraski <zeev@zend.com> CTO, Zend Technologies Ltd. http://www.zend.com/ -- 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

« previous php.general (#25161) next »