HEAD, include(_once), bug in variable declaration

From: Date: Wed, 18 Feb 2004 14:27:56 +0000
Subject: HEAD, include(_once), bug in variable declaration
Groups: php.internals 
Request: Send a blank email to internals+get-7951@lists.php.net to get a copy of this message
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. Am I wrong to see that as a bug? inc.php -------- <?php $foo = "var from include"; ?> testinc.php ----------- <?php function getFoo() { static $calls=0; include_once 'inc.php'; $calls++; echo "calls:$calls\n"; return $foo; } echo getFoo() . "\n"; echo getFoo() . "\n"; ?> hth pierre

« previous php.internals (#7951) next »