note 111107 modified in function.microtime by danbrown

From: Date: Thu, 17 Jan 2013 15:13:54 +0000
Subject: note 111107 modified in function.microtime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-193128@lists.php.net to get a copy of this message
You can use one variable to check execution $time as follow: <?php $time = -microtime(true); $hash = 0; for ($i=0; $i < rand(1000,4000); ++$i) { $hash ^= md5(substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, rand(1,10))); } $time += microtime(true); echo "Hash: $hash iterations:$i time: ",sprintf('%f', $time),PHP_EOL; ?> --was-- You can use one variable to check execution $time as follow: $time = -microtime(true); $hash = 0; for ($i=0; $i < rand(1000,4000); ++$i) { $hash ^= md5(substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, rand(1,10))); } $time += microtime(true); echo "Hash: $hash iterations:$i time: ",sprintf('%f', $time),PHP_EOL; http://php.net/manual/en/function.microtime.php

« previous php.notes (#193128) next »