3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function startAt($x){ function incrementBy($y){ return $x + $y; } return incrementBy; } $closure1 = startAt(1); $closure2 = startAt(5); echo $closure1; echo "<br/>"; echo $closure2;
Output for 7.2.0
Warning: Use of undefined constant incrementBy - assumed 'incrementBy' (this will throw an Error in a future version of PHP) in /in/hT4nP on line 7 Fatal error: Cannot redeclare incrementBy() (previously declared in /in/hT4nP:4) in /in/hT4nP on line 4
Process exited with code 255.
Output for 5.3.20 - 7.1.10
Notice: Use of undefined constant incrementBy - assumed 'incrementBy' in /in/hT4nP on line 7 Fatal error: Cannot redeclare incrementBy() (previously declared in /in/hT4nP:4) in /in/hT4nP on line 4
Process exited with code 255.