3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Source: https://bugs.php.net/bug.php?id=65161 class SyntaxError { public function __construct() { } test.php: <?php function autoload($fullClass) { require_once('SyntaxError.php'); } spl_autoload_register('autoload'); function testGenerator() { yield new SyntaxError('param'); } foreach (testGenerator() as $i);
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected 'test' (T_STRING), expecting function (T_FUNCTION) in /in/Ev6ra on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /in/Ev6ra on line 9
Process exited with code 255.

preferences:
183.08 ms | 1395 KiB | 53 Q