I have a script which runs in a 'while' cycle. I need to determine for how long the script was running for and if it is over 10 seconds terminate it. The code I wrote returns weird decimal values (one second it might be '5.342...' and other it might be '903.322...').
Can someone tell me how can I achieve that?
$timer = microtime(false);...
For a very simple profiling I use microtime() like this:
$now = microtime();
for (...) {
// do something
echo microtime() - $now;
$now = microtime();
}
Now, the output of the echo line seems completely random, that is, I expected fluctuations, but I don't expected negative numbers showing up.
However, a typical result con...
Hello! Here is my code :
$time=microtime();
$len=strlen($time);
echo $time;
echo"<br>".$len."<br>";
$micro;
$i=0;
while($time{$i}!=" ")
{
$micro{i}=$time{i};
echo $micro{i};
$i=$i+1;
}
?>
Now the output,i'm getting is 0000000000(that is $micro) . Here i'm trying to get the microseconds part of the output.
Is there anything wro...