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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to