|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-05-30 19:45 UTC] stas at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 04:00:01 2025 UTC |
// Bug-script for assigning references for global variables inside functions $fruit = "apple"; $rock = "granite"; function twiddle(){ global $fruit, $rock; $fruit = &$rock; $GLOBALS["rock"] = &$GLOBALS["fruit"]; // the "global" command works here echo "inside : fruit=$fruit rock=$rock<br>\n"; } echo "BEFORE: fruit=$fruit rock=$rock<br>"; twiddle(); echo "AFTER: fruit=$fruit rock=$rock"; // But only the reassignment using GLOBALS has an effect outside // the function; the "global" assignment persists only inside. ---------------- PHP configured with mysql ; otherwise plain vanilla.