3v4l.org

run code in 300+ PHP versions simultaneously
<?php $blah = false; echo "calling function \n"; try { test($blah); }catch(\Error $e){ echo "Caught\n"; print_r($e); } function test(array $val){ echo "inside test \n"; print_r($val); echo "\n"; } echo "done\n";
Output for 8.3.0 - 8.3.4
calling function Caught TypeError Object ( [message:protected] => test(): Argument #1 ($val) must be of type array, false given, called in /in/NaqVg on line 8 [string:Error:private] => [code:protected] => 0 [file:protected] => /in/NaqVg [line:protected] => 14 [trace:Error:private] => Array ( [0] => Array ( [file] => /in/NaqVg [line] => 8 [function] => test [args] => Array ( [0] => ) ) ) [previous:Error:private] => ) done
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
calling function Caught TypeError Object ( [message:protected] => test(): Argument #1 ($val) must be of type array, bool given, called in /in/NaqVg on line 8 [string:Error:private] => [code:protected] => 0 [file:protected] => /in/NaqVg [line:protected] => 14 [trace:Error:private] => Array ( [0] => Array ( [file] => /in/NaqVg [line] => 8 [function] => test [args] => Array ( [0] => ) ) ) [previous:Error:private] => ) done
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
calling function Caught TypeError Object ( [message:protected] => Argument 1 passed to test() must be of the type array, bool given, called in /in/NaqVg on line 8 [string:Error:private] => [code:protected] => 0 [file:protected] => /in/NaqVg [line:protected] => 14 [trace:Error:private] => Array ( [0] => Array ( [file] => /in/NaqVg [line] => 8 [function] => test [args] => Array ( [0] => ) ) ) [previous:Error:private] => ) done
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
calling function Caught TypeError Object ( [message:protected] => Argument 1 passed to test() must be of the type array, boolean given, called in /in/NaqVg on line 8 [string:Error:private] => [code:protected] => 0 [file:protected] => /in/NaqVg [line:protected] => 14 [trace:Error:private] => Array ( [0] => Array ( [file] => /in/NaqVg [line] => 8 [function] => test [args] => Array ( [0] => ) ) ) [previous:Error:private] => ) done
Output for 5.6.38
calling function Catchable fatal error: Argument 1 passed to test() must be of the type array, boolean given, called in /in/NaqVg on line 8 and defined in /in/NaqVg on line 14
Process exited with code 255.

preferences:
202.83 ms | 401 KiB | 241 Q