3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 0001111222 ; var_dump($a); var_dump(is_numeric($a)); //true var_dump(ctype_digit($a)); //true var_dump(ctype_digit(77)); echo '分 '; $a = 0.1 ; var_dump($a); var_dump(is_numeric($a)); //true var_dump(ctype_digit($a)); //false $a = -1 ; var_dump($a); var_dump(is_numeric($a)); //true var_dump(ctype_digit($a)); //false $a = a ; var_dump($a); var_dump(is_numeric($a)); //false var_dump(ctype_digit($a)); //false var_dump(sqrt(16)); var_dump(is_int(sqrt(16))); $a = 9.45*100; var_dump($a); var_dump(intval($a)); $a = 945*1.00; var_dump($a); var_dump(intval($a)); $c=null; var_dump(isset($c)); var_dump(is_null ($c)); echo "<br/>数值强制转换:"; $string="2a"; $string1=intval($string); echo '$string1的值:'.$string1.'$string2的值:';//单引号不会输出变量,将原样输出 $string2=(int)($string); echo $string2 ; var_dump(json_encode(array(1,2,3,'4'),"'"));
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
int(299666) bool(true) Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in /in/vUupW on line 6 bool(true) Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in /in/vUupW on line 7 bool(false) 分 float(0.1) bool(true) Deprecated: ctype_digit(): Argument of type float will be interpreted as string in the future in /in/vUupW on line 12 bool(false) int(-1) bool(true) Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in /in/vUupW on line 17 bool(false) Fatal error: Uncaught Error: Undefined constant "a" in /in/vUupW:19 Stack trace: #0 {main} thrown in /in/vUupW on line 19
Process exited with code 255.
Output for 8.0.0 - 8.0.30
int(299666) bool(true) bool(true) bool(false) 分 float(0.1) bool(true) bool(false) int(-1) bool(true) bool(false) Fatal error: Uncaught Error: Undefined constant "a" in /in/vUupW:19 Stack trace: #0 {main} thrown in /in/vUupW on line 19
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
int(299666) bool(true) bool(true) bool(false) 分 float(0.1) bool(true) bool(false) int(-1) bool(true) bool(false) Warning: Use of undefined constant a - assumed 'a' (this will throw an Error in a future version of PHP) in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Warning: json_encode() expects parameter 2 to be int, string given in /in/vUupW on line 42 NULL
Output for 7.2.0 - 7.2.33
int(299666) bool(true) bool(true) bool(false) 分 float(0.1) bool(true) bool(false) int(-1) bool(true) bool(false) Warning: Use of undefined constant a - assumed 'a' (this will throw an Error in a future version of PHP) in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Warning: json_encode() expects parameter 2 to be integer, string given in /in/vUupW on line 42 NULL
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
int(299666) bool(true) bool(true) bool(false) 分 float(0.1) bool(true) bool(false) int(-1) bool(true) bool(false) Notice: Use of undefined constant a - assumed 'a' in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Warning: json_encode() expects parameter 2 to be integer, string given in /in/vUupW on line 42 NULL
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
int(299666) bool(true) bool(true) bool(false) 分 float(0.1) bool(true) bool(false) int(-1) bool(true) bool(false) Notice: Use of undefined constant a - assumed 'a' in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Warning: json_encode() expects parameter 2 to be long, string given in /in/vUupW on line 42 NULL
Output for 5.2.0 - 5.2.17
int(299666) bool(true) bool(true) bool(false) 分 float(0.1) bool(true) bool(false) int(-1) bool(true) bool(false) Notice: Use of undefined constant a - assumed 'a' in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Warning: json_encode() expects exactly 1 parameter, 2 given in /in/vUupW on line 42 NULL
Output for 5.1.0 - 5.1.6
int(299666) bool(true) bool(true) bool(false) 分 float(0.1) bool(true) bool(false) int(-1) bool(true) bool(false) Notice: Use of undefined constant a - assumed 'a' in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Fatal error: Call to undefined function json_encode() in /in/vUupW on line 42
Process exited with code 255.
Output for 5.0.3 - 5.0.5
int(299666) bool(true) bool(true) bool(false) 分 NULL NULL NULL NULL NULL NULL Notice: Use of undefined constant a - assumed 'a' in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Fatal error: Call to undefined function json_encode() in /in/vUupW on line 42
Process exited with code 255.
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.2
int(299666) bool(true)
Process exited with code 139.
Output for 4.4.5 - 4.4.9
int(299666) bool(true) bool(true) bool(false) 分 float(0.1) bool(true) bool(false) int(-1) bool(true) bool(false) Notice: Use of undefined constant a - assumed 'a' in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Fatal error: Call to undefined function: json_encode() in /in/vUupW on line 42
Process exited with code 255.
Output for 4.4.1 - 4.4.4
int(299666) bool(true) bool(true) bool(false) 分 float(0.1) bool(true) bool(false) int(-1) bool(true) bool(false) Notice: Use of undefined constant a - assumed 'a' in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Fatal error: Call to undefined function: json_encode() in /in/vUupW on line 42
Process exited with code 255.
Output for 4.3.10 - 4.3.11, 4.4.0
int(299666) bool(true) bool(true) bool(false) 分 NULL NULL NULL NULL NULL NULL Notice: Use of undefined constant a - assumed 'a' in /in/vUupW on line 19 string(1) "a" bool(false) bool(false) float(4) bool(false) float(945) int(944) float(945) int(945) bool(false) bool(true) <br/>数值强制转换:$string1的值:2$string2的值:2 Fatal error: Call to undefined function: json_encode() in /in/vUupW on line 42
Process exited with code 255.

preferences:
288.04 ms | 402 KiB | 398 Q