3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function handler($errno, $errstr, $errfile, $errline){ echo "Handler in action: \n"; var_export($errstr); return true; } set_error_handler("handler"); $input = "Fly again"; function test(string $test) : string { return $test; } try{ echo test($input); } catch(Exception $ex) { echo "Catched Exception: \n"; var_export($ex); } catch(Error $er) { echo "Catched Error: \n"; var_export($er); }
based on 9Ia7F
Output for 7.0.0 - 7.3.0beta1
Fly again
Output for 5.5.0 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/vWvV8 on line 3 Parse error: syntax error, unexpected ':', expecting '{' in /in/vWvV8 on line 15
Process exited with code 255.