3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!function_exists('nice_number')) { function nice_number($n) { // first strip any formatting; $n = (0 + str_replace(",", "", $n)); // is this a number? if (!is_numeric($n)) return false; // now filter it; $str = ''; if ($n > 1000000000000) $str = round(($n / 1000000000000), 0) . ' tn'; $str .= nice_number($n % 1000000000000); return $str; else if ($n > 1000000000) $str = round(($n / 1000000000), 0) . ' bn'; $str .= nice_number($n % 1000000000); return $str; else if ($n > 1000000) $str = round(($n / 1000000), 0) . ' mn'; $str .= nice_number($n % 1000000); return $str; else if ($n > 1000) return round(($n / 1000), 2) . ' K'; return number_format($n); } } echo nice_number(300200000);
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'else' (T_ELSE) in /in/eGm1F on line 17
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_ELSE in /in/eGm1F on line 17
Process exited with code 255.

preferences:
185.27 ms | 1395 KiB | 64 Q