fork download
  1. <?php
  2. $a = 1;
  3.  
  4. $b = function() use ($a) {
  5.  
  6. function c()
  7. {
  8. global $a;
  9. $a++;
  10. echo("C: ".$a . '</br>');
  11. }
  12.  
  13. echo($a . '</br>');
  14. c();
  15. echo($a . '</br>');
  16. };
  17.  
  18. $b();
  19. echo( "At end: ". $a);
  20. ?>
  21.  
Success #stdin #stdout 0.02s 24228KB
stdin
Standard input is empty
stdout
1</br>C: 2</br>1</br>At end: 2