|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-25 15:22 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
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: