3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function foo() { echo "I am only called once.\n"; return array('a', 'b', 'c', 'd', 'e'); } } $test = new Test(); foreach ($test->foo() as $value) echo $value . "\n"; }
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.17, 5.5.0 - 5.5.1
Parse error: syntax error, unexpected '}' in /in/MICMo on line 16
Process exited with code 255.

preferences:
184.73 ms | 1387 KiB | 55 Q