Jump to content

[SOLVED] will this code round up?


webguync

Recommended Posts

From http://us3.php.net/manual/en/function.number-format.php#88424

this is how number_format() rounds:

<?php

$numbers = array(0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009);

foreach ($numbers as $number)

print $number."->".number_format($number, 2, '.', ',')."<br>";

?>

 

0.001->0.00

0.002->0.00

0.003->0.00

0.004->0.00

0.005->0.01

0.006->0.01

0.007->0.01

0.008->0.01

0.009->0.01

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.