3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CallableStringifier { private static $callables = array(); public static function stringify($callable) { $id = count(self::$callables); self::$callables[$id] = $callable; return 'return ' . __CLASS__ . "::call($id, func_get_args());"; } public static function call($id, $args) { return call_user_func_array(self::$callables[$id], $args); } } $func = create_function('$arg1', CallableStringifier::stringify(function($arg1) { return $arg1; })); echo $func(echo '1111';); // outputs 1
Output for 5.4.0 - 5.4.23
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting ')' in /in/mSqYe on line 24
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_ECHO, expecting ')' in /in/mSqYe on line 24
Process exited with code 255.

preferences:
180.06 ms | 1395 KiB | 60 Q