fork download
  1. <?php
  2.  
  3. $a = 1;
  4. $x = function ($n) use ($a) {
  5. echo "a=$a, n=$n\n";
  6. }
  7.  
  8. $x(10); // a=1,n=10
  9. $a = 2;
  10. $x(5); // a=1, n=5
Runtime error #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected '$x' (T_VARIABLE) in /home/fuuAPT/prog.php on line 8