note 95635 deleted from function.number-format by danbrown

From: Date: Wed, 13 Jan 2010 15:50:16 +0000
Subject: note 95635 deleted from function.number-format by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164913@lists.php.net to get a copy of this message
Note Submitter: ricardophp (at) yahoo com br ---- <?php // More samples of rounding numbers for ($i=0.001; $i<1; $i+=0.001) { echo $i." = ".number_format($i, 2, ',', '.')."\n"; } // some echos: // 0,001 = 0,00 // 0,004 = 0,00 // 0,005 = 0,01 // 0,009 = 0,01 // 0,010 = 0,01 // 0,011 = 0,01 // 0,013 = 0,01 // 0,014 = 0,01 // 0,015 = 0,02 // 0,016 = 0,02 // 0,024 = 0,02 // 0,025 = 0,03 // 0,026 = 0,03 // 0,099 = 0,10 // 0,100 = 0,10 // 0,101 = 0,10 // 0,293 = 0,29 // 0,294 = 0,29 // 0,295 = 0,30 // 0,296 = 0,30 // 0,299 = 0,30 // 0,300 = 0,30 // 0,301 = 0,30 // if its less them 5 it rounds down // otherwise (if its equals to or higher them) them rounds up ?>

« previous php.notes (#164913) next »