3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $var1 = 123; $var2 = '456A'; $var3 = 789; echo to_number($var1) . "\n"; echo to_number($var2) . "\n"; echo to_number($var3) . "\n"; echo $var2 + 0, "\n"; # convert var to number function to_number($var) { return 0 + $var; }
based on oEKPD
Output for 7.1.0 - 7.2.0
123 Notice: A non well formed numeric value encountered in /in/cmNve on line 19 456 789 Notice: A non well formed numeric value encountered in /in/cmNve on line 14 456
Output for 4.3.0 - 7.0.20
123 456 789 456