3v4l.org

run code in 500+ PHP versions simultaneously
<?php foreach(['-1', '0', '1', '1e10', 'a', 'hello', 1, -1, 0, true, false, 1.0, 0.0, 1.3] as $s) { var_dump($s); var_dump(ctype_digit($s)); $arr[$s] = 1; var_dump(array_key_first($arr)); echo "\n"; }
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.21, 8.5.0 - 8.5.6
string(2) "-1" bool(false) int(-1) string(1) "0" bool(true) int(-1) string(1) "1" bool(true) int(-1) string(4) "1e10" bool(false) int(-1) string(1) "a" bool(false) int(-1) string(5) "hello" bool(false) int(-1) int(1) Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in /in/vo6gg on line 6 bool(false) int(-1) int(-1) Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in /in/vo6gg on line 6 bool(false) int(-1) int(0) Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in /in/vo6gg on line 6 bool(false) int(-1) bool(true) Deprecated: ctype_digit(): Argument of type bool will be interpreted as string in the future in /in/vo6gg on line 6 bool(false) int(-1) bool(false) Deprecated: ctype_digit(): Argument of type bool will be interpreted as string in the future in /in/vo6gg on line 6 bool(false) int(-1) float(1) Deprecated: ctype_digit(): Argument of type float will be interpreted as string in the future in /in/vo6gg on line 6 bool(false) int(-1) float(0) Deprecated: ctype_digit(): Argument of type float will be interpreted as string in the future in /in/vo6gg on line 6 bool(false) int(-1) float(1.3) Deprecated: ctype_digit(): Argument of type float will be interpreted as string in the future in /in/vo6gg on line 6 bool(false) Deprecated: Implicit conversion from float 1.3 to int loses precision in /in/vo6gg on line 8 int(-1)
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
string(2) "-1" bool(false) int(-1) string(1) "0" bool(true) int(-1) string(1) "1" bool(true) int(-1) string(4) "1e10" bool(false) int(-1) string(1) "a" bool(false) int(-1) string(5) "hello" bool(false) int(-1) int(1) bool(false) int(-1) int(-1) bool(false) int(-1) int(0) bool(false) int(-1) bool(true) bool(false) int(-1) bool(false) bool(false) int(-1) float(1) bool(false) int(-1) float(0) bool(false) int(-1) float(1.3) bool(false) int(-1)
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34
string(2) "-1" bool(false) Fatal error: Uncaught Error: Call to undefined function array_key_first() in /in/vo6gg:9 Stack trace: #0 {main} thrown in /in/vo6gg on line 9
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
string(2) "-1" bool(false) Fatal error: Call to undefined function array_key_first() in /in/vo6gg on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/vo6gg 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, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/vo6gg on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/vo6gg on line 3
Process exited with code 255.

preferences:
97.18 ms | 2977 KiB | 4 Q