ID: 16207
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: linux 2.2.20
PHP Version: 4.1.2
New Comment:
That's a limitation of the engine. 'global'ized variables inside
function are in fact references to the global variable.
Previous Comments:
------------------------------------------------------------------------
[2002-03-21 12:57:51] [EMAIL PROTECTED]
Hello,
Using references from and to global vars inside a function doesnt seem
to work.
Try this out:
---->8----->8----->8----->8-
<?
function SomeFunction()
{
global $a, $b, $c;
$d = array(1, 2, 3);
$a = $d;
$b = &$a;
$c = &$a;
}
SomeFunction();
?><pre>a:<br><?print_r($a)?></pre><hr><?
?><pre>b:<br><?print_r($b)?></pre><hr><?
?><pre>c:<br><?print_r($c)?></pre><hr><?
// end
?>
---->8----->8----->8----->8-
Logically, $b and $c should be references to $a, but they seem to be
empty vars!
Thanks,
-- vedad
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16207&edit=1