Date(); returning same time even with an event in php -
is there way this? because both $timestart , $timestop give me same result tho theres event between both.
<?php $timestart = strtotime(date('h:i:s', time())); if(isset($_post['choix186']) ){ $timestop = strtotime(date('h:i:s', time())); $duree = $timestop - $timestart; } print $duree"; ?>
the "standard" timer script one:
example #1 timing script execution microtime()
$time_start = microtime_float(); // sleep while usleep(100); $time_end = microtime_float(); $time = $time_end - $time_start; echo "did nothing in $time seconds\n"; ?>
example #2 timing script execution in php 5
<?php $time_start = microtime(true); // sleep while usleep(100); $time_end = microtime(true); $time = $time_end - $time_start; echo "did nothing in $time seconds\n"; ?>
example #3 microtime() , request_time_float (as of php 5.4.0)
<?php // randomize sleeping time usleep(mt_rand(100, 10000)); // of php 5.4.0, request_time_float available in $_server superglobal array. // contains timestamp of start of request microsecond precision. $time = microtime(true) - $_server["request_time_float"]; echo "did nothing in $time seconds\n"; ?>
source: http://php.net/manual/en/function.microtime.php
nothing add, manual knows all
Comments
Post a Comment