3v4l.org

run code in 300+ PHP versions simultaneously
<?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']); }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
error reporting value is : 4437 2
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 error reporting value is : 4437 2
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
error reporting value is : 0 2
Output for 7.0.0 - 7.0.33
error reporting value is : 0 2 Fatal error: Uncaught TypeError: Return value of phpErrorHandler() must be an instance of void, none returned in /in/kVP1S:14 Stack trace: #0 [internal function]: phpErrorHandler(2, 'mkdir(): open_b...', '/in/kVP1S', 6, Array) #1 /in/kVP1S(6): mkdir('test') #2 {main} thrown in /in/kVP1S on line 14 error reporting value is : -1 1error reporting value is : -1 error type : 1 error message : Uncaught TypeError: Return value of phpErrorHandler() must be an instance of void, none returned in /in/kVP1S:14 Stack trace: #0 [internal function]: phpErrorHandler(2, 'mkdir(): open_b...', '/in/kVP1S', 6, Array) #1 /in/kVP1S(6): mkdir('test') #2 {main} thrown error file : /in/kVP1S error line : 14 Fatal error: Uncaught TypeError: Return value of phpErrorHandler() must be an instance of void, none returned in /in/kVP1S:23 Stack trace: #0 /in/kVP1S(34): phpErrorHandler(1, 'Uncaught TypeEr...', '/in/kVP1S', 14) #1 [internal function]: execOnShutdown() #2 {main} thrown in /in/kVP1S on line 23
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Parse error: syntax error, unexpected ':', expecting '{' in /in/kVP1S on line 9
Process exited with code 255.

preferences:
253.48 ms | 401 KiB | 287 Q