[Phpmyadmin-devel] header.inc.php3 safty net

Marc Delisle DelislMa at CollegeSherbrooke.qc.ca
Thu Jul 26 19:19:48 CEST 2001


Hi Jeremy,

from the PHP manual:
--------------------
require() is not actually a function in PHP; rather, it is a language construct. It is subject to
some different rules than functions are. For instance, require() is not subject to any containing
control structures.

Unlike include(), require() will always read in the target file, even if the line it's on never
executes. If you want to conditionally include a file, use include(). The conditional statement
won't affect the require(). However, if the line on which the require() occurs is not executed,
neither will any of the code in the target file be executed. 
-----------------------

If I understand correctly the manual, this code won't work:

if (!defined('__HEADER_INC__'))
  require("./header.inc.php3");

Marc

jeremy brand a écrit :
> 
> Howdy all.
> 
> I have defined "__HEADER_INC__" in header.inc.php3 and also made the
> requires that require header.inc.php3 conditional.
> 
> Also, a slight programmer note:
> Anyone adding code to this project should, when requiring header.inc.php3,
> only do it if !defined('__HEADER_INC___').
> 
> Jeremy
>




More information about the Developers mailing list