3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function count_number($n) { // first strip any formatting; $n = (0+str_replace(",","",$n)); // is this a number? if(!is_numeric($n)) return false; // now filter it; if($n>1000000000000) return floor(($n/1000000000000)).'T'; else if($n>1000000000) return floor(($n/1000000000)).'G'; else if($n>1000000) return floor(($n/1000000)).'M'; else if($n>1000) return floor(($n/1000)).'K'; return number_format($n); } echo count_number("2,454");
based on 0Q3q3
Output for 4.3.0 - 7.2.0
2K