3 function function_scope() {
4 // Shouldn't try to capture $k
6 foreach (array(1,2,3,4) as $k) {
12 // Also shouldn't capture $x, $y:
20 // But this will capture $z, however it will be uninit at closure
21 // allocation time (in non-repo mode). It will give a warning
22 // closure call time. It will also give an ahead-of-type error
23 // from hh about $z not being defined.
24 $quux = () ==> { var_dump(isset($z)); };
25 $z = "function scope is weird\n";
26 echo "z in parent is now: $z\n";
27 $quux(); // print NULL