note 66427 deleted from function.number-format by cmb

From: Date: Sun, 13 Jan 2019 10:45:02 +0000
Subject: note 66427 deleted from function.number-format by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210053@lists.php.net to get a copy of this message
Note Submitter: rudie at jouwmoeder dot nl ---- 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!

« previous php.notes (#210053) next »