fork download
  1. <?php
  2. $a = 3;
  3. $b = &$a;
  4. echo 'B = '.$b."\n";
  5. $b = 2;
  6. echo 'A = '.$a."\n";
  7. $a = 5;
  8. echo 'B = '.$b."\n";
  9.  
  10. function links(&$var){
  11. $var = 1;
  12. global $a;
  13. $a = 3;
  14. echo 'GLOBAL A = '.$a."\n";
  15. echo 'VAR = '.$var."\n";
  16. return $var+1;
  17. }
  18.  
  19. $a = links($a);
  20. echo 'B = '.$b."\n";
  21. echo 'A = '.$a."\n";
  22.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
B = 3
A = 2
B = 5
GLOBAL A = 3
VAR = 3
B = 4
A = 4