note 40740 added to function.require-once
| From: | jaisen-at-jmathai-dot-com at rn2 dot php dot net | Date: | Fri, 12 Mar 2004 17:16:08 +0000 |
| Subject: | note 40740 added to function.require-once | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66743@lists.php.net to get a copy of this message | ||
NOTE: This function changed how it worked. In PHP 3 this behaved very differently than it does on
PHP 4. Require used to include and parse the file regardless where the require line was positioned.
For example (PHP3):
<?php
if(false){ require_once 'file_does_not_exist.php'; }
?>
That code throw a fatal exception even though it's in a conditional block which evaluates to
false. In PHP 4 the file is never included or parsed, so no exception is thrown.
For example (PHP4)
<?php
if(false){ require_once '1_file_does_not_exists.php'; }
require_once '2_file_does_not_exists.php';
?>
Stops execution of the script on trying to require the 2nd file...by bypasses the first require.
--JM
----
Manual Page -- http://www.php.net/manual/en/function.require-once.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40740
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40740&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40740&report=yes
Search -- http://master.php.net/manage/user-notes.php