3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function makeLouder($fn) { return function($a) use($fn) { return $fn($a)."!!!"; }; } $foo = makeLouder(abs); echo "<p>".$foo(900)."<br/>".$foo(-900); $bar = makeLouder(strtoupper); echo "<p>".$bar("upper");
based on K5GYC
Output for 7.2.0
Warning: Use of undefined constant abs - assumed 'abs' (this will throw an Error in a future version of PHP) in /in/6OA3Q on line 7 <p>900!!!<br/>900!!! Warning: Use of undefined constant strtoupper - assumed 'strtoupper' (this will throw an Error in a future version of PHP) in /in/6OA3Q on line 9 <p>UPPER!!!
Output for 5.3.19 - 7.1.10
Notice: Use of undefined constant abs - assumed 'abs' in /in/6OA3Q on line 7 <p>900!!!<br/>900!!! Notice: Use of undefined constant strtoupper - assumed 'strtoupper' in /in/6OA3Q on line 9 <p>UPPER!!!