ID:               31688
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mike at somosis dot co dot uk
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: FreeBSD (experienced on others)
 PHP Version:      4.3.10
 New Comment:

RTFM:

http://www.php.net/variables.scope
"..assigning a reference to a static variable, it's not remembered.."

Last example in the page.




Previous Comments:
------------------------------------------------------------------------

[2005-01-25 15:04:38] mike at somosis dot co dot uk

Description:
------------
Static variables that are assigned to by reference in a function lose
the assignment when the function terminates.

Reproduce code:
---------------
function a(&$v, $s) {
        static $x;

        if($s)
                $x =& $v;
        
        print("\$x in a: {$x}<br />\n");
}

$c = 1;

a($c, true);
a($c, false);


Expected result:
----------------
$x in a: 1
$x in a: 1


Actual result:
--------------
$x in a: 1
$x in a: 



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31688&edit=1

Reply via email to