全部博文(42)
分类:
2008-04-05 17:45:06
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$n = 100000;
print '1. (microtime): ';
$start = microtime(true);
for ($i=0; $i<$n; $i++) {
$test = microtime();
}
print (microtime(true) - $start) . "s used \n";
print $test ."\n";
print '2. (microtime): ';
$start = microtime(true);
for ($i=0; $i<$n; $i++) {
$test = microtime(true);
}
print (microtime(true) - $start) . "s used \n";
print $test ."\n";
print '3. uniqid: ';
$start = microtime(true);
for ($i=0; $i<$n; $i++) {
$test = uniqid('uid', false);
}
print (microtime(true) - $start) . "s used \n";
print $test . "\n\n\n";