3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $vals = array('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.2.2 - 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.3.3 - 5.2.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 1.0E+8 an int? '100000000' == '100000000' --> true
Output for 4.3.0 - 4.3.2
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 1.E+8 an int? '100000000' == '100000000' --> true