3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php \register_shutdown_function('execOnShutdown'); \set_error_handler('phpErrorHandler'); @mkdir('test'); function phpErrorHandler(int $errorType, string $errorMessage, string $errorFile, int $errorLine) : void { echo 'error reporting value is : ' . error_reporting() . PHP_EOL; echo $errorType; if (!(error_reporting() & $errorType)) { return; } echo 'error reporting value is : ' . error_reporting() . PHP_EOL; echo('error type : ' . $errorType) . PHP_EOL; echo('error message : ' . $errorMessage) . PHP_EOL; echo('error file : ' . $errorFile) . PHP_EOL; echo('error line : ' . $errorLine) . PHP_EOL; return; } function execOnShutdown() : void { $error = \error_get_last(); if (! $error) { return; } phpErrorHandler($error['type'], $error['message'], $error['file'], $error['line']); }
based on f7ekM
Output for hhvm-3.21.3 - 3.22.0, 7.1.0 - 7.3.0beta1
error reporting value is : 0 2
Output for hhvm-3.18.5
error reporting value is : 0 2 Fatal error: Uncaught TypeError: Value returned from function phpErrorHandler() must be of type void, null given in /in/kVP1S:14 Stack trace: #0 /in/kVP1S(6): phpErrorHandler() #1 {main} error reporting value is : 8191 0 Fatal error: Uncaught TypeError: Value returned from function phpErrorHandler() must be of type void, null given in /in/kVP1S:14 Stack trace: #0 /in/kVP1S(34): phpErrorHandler() #1 (): execOnShutdown() #2 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting '{' in /in/kVP1S on line 9
Process exited with code 255.