3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(array $x) {} set_error_handler( function($error_level, $message, $filename, $line, $context){ $error_level_str = implode( ', ', array_filter( array_keys(get_defined_constants(), $error_level), function($v) { return 0 === strpos($v, 'E_'); })); print "ERROR ($error_level_str):\n"; var_export(get_defined_vars()); print "\n"; }); foo(5); print "No problem\n";
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught TypeError: foo(): Argument #1 ($x) must be of type array, int given, called in /in/neFdl on line 20 and defined in /in/neFdl:3 Stack trace: #0 /in/neFdl(20): foo(5) #1 {main} thrown in /in/neFdl on line 3
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type array, int given, called in /in/neFdl on line 20 and defined in /in/neFdl:3 Stack trace: #0 /in/neFdl(20): foo(5) #1 {main} thrown in /in/neFdl on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.25, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type array, integer given, called in /in/neFdl on line 20 and defined in /in/neFdl:3 Stack trace: #0 /in/neFdl(20): foo(5) #1 {main} thrown in /in/neFdl on line 3
Process exited with code 255.
Output for 5.6.0
ERROR (E_RECOVERABLE_ERROR): array ( 'error_level' => 4096, 'message' => 'Argument 1 passed to foo() must be of the type array, integer given, called in /in/neFdl on line 20 and defined', 'filename' => '/in/neFdl', 'line' => 3, 'context' => array ( ), 'error_level_str' => 'E_RECOVERABLE_ERROR', ) No problem
Output for 5.0.0
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/neFdl on line 3
Process exited with code 255.

preferences:
48.13 ms | 1625 KiB | 4 Q