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

From: Date: Tue, 14 Nov 2000 08:39:40 +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-25157@lists.php.net to get a copy of this message
>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) Thanks, Maxim Maletsky

« previous php.general (#25157) next »