3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $vals = ['3 fish', ' +01.0001 ', ' +01.0000000 ', true, false, null, 1e8]; foreach ($vals as $val) { printf("is %s an int? %s == %s --> %s\n", var_export($val, true), var_export((string)(int)$val, true), var_export(trim($val), true), var_export((string)(int)$val == trim($val), true) ); }
Output for 7.0.2 - 7.1.0
is '3 fish' an int? '3' == '3 fish' --> false is ' +01.0001 ' an int? '1' == '+01.0001' --> false is ' +01.0000000 ' an int? '1' == '+01.0000000' --> true is true an int? '1' == '1' --> true is false an int? '0' == '' --> false is NULL an int? '0' == '' --> false is 100000000.0 an int? '100000000' == '100000000' --> true
Output for 5.4.0 - 7.0.1
is '3 fish' an int? '3' == '3 fish' --> false is ' +01.0001 ' an int? '1' == '+01.0001' --> false is ' +01.0000000 ' an int? '1' == '+01.0000000' --> true is true an int? '1' == '1' --> true is false an int? '0' == '' --> false is NULL an int? '0' == '' --> false is 100000000 an int? '100000000' == '100000000' --> true
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/73Ium on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/73Ium on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/73Ium on line 3
Process exited with code 255.