<?php $a = 1;$b = 2;$x = function ($n) use (&$a, $b) {echo "a=$a, b=$b, n=$n\n";}; $x(10); // a=1,b=2,n=10$a = 3;$b = 3;$x(5); // a=3, b=2, n=5
Standard input is empty
a=1, b=2, n=10 a=3, b=2, n=5
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!