For those of you who often work with PHP programming language may have experienced difficulties in formatting the numbers into cash. Likewise with me before I found this function, I have difficulty when faced with the problem format.
The solution I use the PHP function number_format() to set the format of these numbers. The syntax is as follows:
number_format (n [, x [, y, z]);
with the parameter n is the number that will be formatted (the type is float or real, may also integers), x is the number of decimal digits in the decimal point (for real numbers), y is the string as a decimal separator, and z is the string as a group separator per thousand.
Example:
// display the Rp. 2.862.077.550,27
$number = 2862077550.2734
$bil = number_format ($number, 2,',','.');
echo "Rp.". $ bil;
?>
Easy is not it?
Good luck ...
Subscribe to:
Posts (Atom)