<?php $a = 1; $x = 2; function test() { global $a; global $x; $GLOBALS['a'] = &$x; $x = 5; echo $a . PHP_EOL; echo $x . PHP_EOL; } test(); echo PHP_EOL; echo $a . PHP_EOL; // $a is 1 here instead of 5 echo $x . PHP_EOL; $a = &$x; echo PHP_EOL; echo $a . PHP_EOL; echo $x . PHP_EOL;
You have javascript disabled. You will not be able to edit any code.