#26307 [Opn->Bgs]: Variable reference assignments in functions
| From: | sniper@php.net | Date: | Tue, 18 Nov 2003 21:47:00 +0000 |
| Subject: | #26307 [Opn->Bgs]: Variable reference assignments in functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-50662@lists.php.net to get a copy of this message | ||
ID: 26307
Updated by: sniper@php.net
Reported By: soywiz at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Windows
PHP Version: 4.3.4
New Comment:
RTFM:
http://www.php.net/manual/en/language.references.arent.php
Previous Comments:
------------------------------------------------------------------------
[2003-11-18 15:58:01] soywiz at hotmail dot com
Description:
------------
Within a function a reference to another variable cannot be assigned to
its to a global variable.
I also proved this example in php 4.3.3
Sorry by my bad english
In spanish: Dentro de una función no se le puede asignar a una variable
global una referencia a otra variable (también global).
He probado este ejemplo en php 4.3.3 y php 4.3.4
Reproduce code:
---------------
<?php
$a = 'a';
$b = 'b';
function f() {
global $a, $b;
$b = &$a; // Fails
}
f();
echo $b;
$b = &$a; // Works
echo $b;
?>
Expected result:
----------------
aa
Actual result:
--------------
ba
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26307&edit=1