3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php print_num('.11e2'); var_dump('11e0' == '.11e2'); var_dump('11e0' == '.011e3'); var_dump('1.1e1' == '.11e2'); echo ".11e2 = ", 0 + '.11e2', "\n"; echo "1.1e1 = ", 0 + '1.1e1', "\n"; function print_num() { $args = func_get_args(); foreach ($args as $str) { $num = 0 + $str; $num2 = $str + 0; if ($num <> $num2) {echo "MASSIVE ERROR!! Ignoring..."; } echo "$str = $num\n"; } }
based on u3bb0
Output for 4.3.0 - 5.0.0, 5.0.2 - 7.1.0
.11e2 = 11 bool(true) bool(true) bool(true) .11e2 = 11 1.1e1 = 11
Output for 5.0.1
.11e2 = 0 bool(false) bool(false) bool(false) .11e2 = 0 1.1e1 = 11