Formatting numbers / php
Posted by Viktor Klymonchuk on 31 August 2011 03:39 PM

number_formatFormat a number with grouped thousands

<?php

$number
= 1234.56;

// english notation (default)
$english_format_number = number_format($number);
// 1,235

// French notation
$nombre_format_francais = number_format($number, 2, ',', ' ');
// 1 234,56

$number = 1234.5678;

// english notation without thousands separator
$english_format_number = number_format($number, 2, '.', '');
// 1234.57

?>

Read more: http://php.net/manual/en/function.number-format.php

(0 vote(s))
Helpful
Not helpful

Comments (0)
Managed by WebCTO