If I put quotes around the string it works: if(!defined('_FOO_INC')):
> file ee: > <? > if(!defined(_FOO_INC)): > define('_FOO_INC',1); > function foo() { > echo "Hello World\n"; > } > endif; > ?> > > file ee1: > <? > include 'ee'; > include 'ee'; > foo(); > ?> > > 10:11am rasmus:~> php ee1 > X-Powered-By: PHP/4.0.8-dev > Content-type: text/html > > <br /> > <b>Fatal error</b>: Cannot redeclare foo() (previously declared in > /usr/local/home/rasmus/ee:5) in <b>/usr/local/home/rasmus/ee</b> on line > <b>4</b><br /> > /usr/local/home/rasmus/ee(4) : Fatal error - Cannot redeclare foo() > (previously declared in /usr/local/home/rasmus/ee:5) > > > > On Fri, 19 Oct 2001, Zeev Suraski wrote: > > > Nope, Edin was right. It's valid in both senses. > > > > Zeev > > > > At 11:50 19-10-01, Rasmus Lerdorf wrote: > > >It is valid in the sense that the code would not be executed the second > > >time, but it isn't valid for preventing multiple function definitions > > >inside that block. ie. no conditional function definitions. > > > > > >-Rasmus > > > > > >On Fri, 19 Oct 2001, Edin Kadribasic wrote: > > > > > > > > Since you can no longer do: > > > > > > > > > > if(!defined(_FOO_INC)): > > > > > define('_FOO_INC',1); > > > > > > > > > > ... > > > > > > > > > > endif; > > > > > > > > > > to protect a file from multiple inclusion within the file itself, some > > > > > > > > This is still a valid construct. I could find nothing in the discussion > > > that > > > > would indicate otherwise. The only thing that does not work now, and it did > > > > before was: > > > > > > > > if(!defined(_FOO_INC)): > > > > define('_FOO_INC',1); > > > > return; > > > > endif; > > > > ... > > > > ... > > > > > > > > > > > > > > > > > > > > > > > > >-- > > >PHP Development Mailing List <http://www.php.net/> > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > >For additional commands, e-mail: [EMAIL PROTECTED] > > >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]