Bug #16207 Updated: var referencing doesnt work on global vars?
| From: | mfischer@php.net | Date: | Thu, 21 Mar 2002 18:01:11 +0000 |
| Subject: | Bug #16207 Updated: var referencing doesnt work on global vars? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-3074@lists.php.net to get a copy of this message | ||
ID: 16207
Updated by: mfischer@php.net
Reported By: vedad@kajtaz.net
-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] vedad@kajtaz.net
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