Quantcast
Channel: bitPrison.net - Web development
Viewing all articles
Browse latest Browse all 23

HTML number formatting with PHP

$
0
0

Here is my HTML number formatter. Sometimes the browsers wrap the numbers along thousand separator or decimal pont, but this function prevents this event.

function html_number_format($number, $decimals = 2, $dec_point = '.', $thousands_sep = ',') {
  if ($number === FALSE) {
    return '---';
  }
  return '<span style="white-space: nowrap;">'.number_format($number, $decimals, $dec_point, $thousands_sep).'</span>';
}

Viewing all articles
Browse latest Browse all 23

Trending Articles