Re: Re: HEAD, include(_once), bug in variable declaration

From: Date: Wed, 18 Feb 2004 14:44:08 +0000
Subject: Re: Re: HEAD, include(_once), bug in variable declaration
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-7954@lists.php.net to get a copy of this message
On Wed, 18 Feb 2004 15:39:10 +0100 Pierre-Alain Joye <paj@pearfr.org> wrote: > On Wed, 18 Feb 2004 15:27:56 +0100 > paj@pearfr.org (Pierre-Alain Joye) wrote: > > > Hello, > > > > Having the scripts pasted below: > > > > include_once fails to declare the variable 'foo'. Replace include_once > > by include and it works. I got the same behavior using require and > > require_once. > > To be precised: it fails to declare the variable on the 2nd call. The > 1st call works. because it doesn't really include this file on the 2nd call. [quote] include_once() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc. [/quote] thus, this is expected behaviour. --- WBR, Antony Dovgal aka tony2001 tony2001@phpclub.net

« previous php.internals (#7954) next »