note 25950 added to function.require
| From: | skyLined at edup dot tudelft dot nl | Date: | Sat, 12 Oct 2002 12:15:16 +0000 |
| Subject: | note 25950 added to function.require | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37974@lists.php.net to get a copy of this message | ||
require()-ing a file twice will usually produce errors because functions can't be redefined.
This is a problem when running a.php when a.php requires b.php and c.php and b.php also requires
c.php. To solve this problem in a "C" style use this code:
c.php:
<?php
if (!isset($_c_)) {
global $_c_; $_c_ = true;
//normal php code
}
?>
--
http://www.php.net/manual/en/function.require.php
http://master.php.net/manage/user-notes.php?action=edit+25950
http://master.php.net/manage/user-notes.php?action=delete+25950
http://master.php.net/manage/user-notes.php?action=reject+25950