3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $number = 13000000; // Here's the function function formatter ($number) { $bil = floor ($number / 1000000000); $millions = $number % 1000000000; $mil = floor ($millions / 1000000); $thousands = $millions % 1000000; $thou = floor ($thousands / 1000); $str = ''; if ($bil != 0) { $str .= "{$bil} billions "; } if ($mil != 0) { $str .= "{$mil} millions "; } if ($thou != 0) { $str .= "{$thou} thousands "; } echo $str; }
based on l9YJ0
Output for 4.3.0 - 7.2.0