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 round(($n/1000000000000),1).'T'; else if($n>1000000000) return round(($n/1000000000),1).'G'; else if($n>1000000) return round(($n/1000000),1).'M'; else if($n>1000) return round(($n/1000),1).0'K'; return number_format($n); } echo count_number("2,000");
based on UQ9s1
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '.0' (T_DNUMBER), expecting ';' in /in/coJCC on line 13
Process exited with code 255.
Output for 5.4.11 - 5.6.17
Parse error: syntax error, unexpected '.0' (T_DNUMBER) in /in/coJCC on line 13
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_DNUMBER in /in/coJCC on line 13
Process exited with code 255.