Re: [PHP4BETA] nested includes

From: Date: Mon, 17 Jan 2000 22:51:05 +0000
Subject: Re: [PHP4BETA] nested includes
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-9204@lists.php.net to get a copy of this message
At 00:44 18/01/2000 , Dan wrote:
I really needed the ability to have include files include other files. After some struggling, I have something that works w/beta2 of PHP4. Please let me know if I'm going to break w/a current or future version. If it holds up, I hope it helps others to solve this common affliction. (for a file called constants.ph) <? if ("string" == gettype( CONSTANTS_PH )) { define( "CONSTANTS_PH", 1 ); // constants shared by all pages } // end of if (! CONSTANTS_PH ) ?> Some of you will instantly get it, but it took me a while to realize that testing for CONSTANTS_PH was tough because it would be treated as a string, due to the relaxed quote requirements of PHP.
If you turn of notices (E_NOTICE), you'd get a warning if you use an undefined constant (which is, in other words, a string that is not enclosed inside quotes). Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.version4 (#9204) next »