3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check($function, ...$args) { try { $function(...$args); echo "okay $function\n"; } catch (ArgumentCountError $e) { echo "fail {$e->getMessage()}\n"; } } check("class_exists", "stdClass", false, 123); check("count", [], COUNT_NORMAL, 123); check("base64_encode", "string", 123); check("file_get_contents", __FILE__, false, null, 0, null, 123); check("mb_strlen", "string", "ASCII", 123); check("strlen", "string", 123);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
fail class_exists() expects at most 2 arguments, 3 given fail count() expects at most 2 arguments, 3 given fail base64_encode() expects exactly 1 argument, 2 given fail file_get_contents() expects at most 5 arguments, 6 given fail mb_strlen() expects at most 2 arguments, 3 given fail strlen() expects exactly 1 argument, 2 given
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: class_exists() expects at most 2 parameters, 3 given in /in/H0bmY on line 5 okay class_exists Warning: count() expects at most 2 parameters, 3 given in /in/H0bmY on line 5 okay count Warning: base64_encode() expects exactly 1 parameter, 2 given in /in/H0bmY on line 5 okay base64_encode Warning: file_get_contents() expects at most 5 parameters, 6 given in /in/H0bmY on line 5 okay file_get_contents Warning: mb_strlen() expects at most 2 parameters, 3 given in /in/H0bmY on line 5 okay mb_strlen Warning: strlen() expects exactly 1 parameter, 2 given in /in/H0bmY on line 5 okay strlen
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /in/H0bmY on line 3
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '.', expecting '&' or T_VARIABLE in /in/H0bmY on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '.', expecting '&' or T_VARIABLE in /in/H0bmY on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '.', expecting '&' or T_VARIABLE or T_CONST in /in/H0bmY on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected '.', expecting '&' or T_VARIABLE or T_CONST in /in/H0bmY on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'&'' or `T_VARIABLE' or `T_CONST' in /in/H0bmY on line 3
Process exited with code 255.

preferences:
45.75 ms | 416 KiB | 5 Q