note 66427 added to function.number-format
| From: | rudie at jouwmoeder dot nl | Date: | Mon, 22 May 2006 09:30:35 +0000 |
| Subject: | note 66427 added to function.number-format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-111809@lists.php.net to get a copy of this message | ||
number_format is pretty fast. It's much slower than calculation though:
<?php
$start = microtime(true);
echo "<pre>";
for ($i=0;$i<100000;$i++)
{
echo number_format(microtime(true)-$start,25)."\n";
}
echo "<hr />Parsetime: ".(microtime(true)-$start);
?>
This takes 1.03 seconds all the time. Without the -$start in the number_format cmd, it takes exactly
as long (I ran it about 20 times).
The simple calculation inside number_format takes relatively no time. Defining the number before
entering it into number_format also gives no change:
{
$num = microtime(true)-$start;
echo number_format($num,25)."\n";
}
Which concludes it takes about .01 sec to do a thousand number_format.
If you'd do the same routine without the number_format, it'd take .75 seconds ->
number_format very fast!
----
Server IP: 194.109.193.119
Probable Submitter: 217.195.249.69
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.number-format.php
Edit -- http://master.php.net/note/edit/66427
Del: integrated -- http://master.php.net/note/delete/66427/integrated
Del: useless -- http://master.php.net/note/delete/66427/useless
Del: bad code -- http://master.php.net/note/delete/66427/bad+code
Del: spam -- http://master.php.net/note/delete/66427/spam
Del: non-english -- http://master.php.net/note/delete/66427/non-english
Del: in docs -- http://master.php.net/note/delete/66427/in+docs
Del: other reasons-- http://master.php.net/note/delete/66427
Reject -- http://master.php.net/note/reject/66427
Search -- http://master.php.net/manage/user-notes.php