3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { public function each($function) { for($i=0; $i<3; $i++) { call_user_func($function, $i); } } public function isEqual($value, &$a = null, &$b = null) { $a = $value; $b = 1; return $a == $b; } public function action($force = false) { $this->each(function($i) { if (isEqual($i, $a, $b) || $force) { echo $i . PHP_EOL; } } } } $a = new X(); $a->action(); $a->action(true);
Output for 7.0.0
Parse error: syntax error, unexpected '}', expecting ',' or ')' in /in/hZciN on line 26
Process exited with code 255.
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected '}' in /in/hZciN on line 26
Process exited with code 255.

preferences:
164.79 ms | 1399 KiB | 24 Q