I've got a list of functions I am timing so that I might try and optimize some code:
$totalTime = microtime(true);
$time = microtime(true);
// function 1 .05 seconds
$func_1_time = microtime(true) - $time;
$time = microtime(true);
// function 2 .05 seconds
$func_2_time = microtime(true) - $time;
$time = microtime(true);
// function 3 .05 seconds
$func_3_time = microtime(true) - $time;
$time = microtime(true);
// function 4 .05 seconds
$func_4_time = microtime(true) - $time;
$timeTotals = $func_1_time + $func_2_time + $func_3_time + $func_4_time;
$totalTime = microtime(true) - $totalTime;
This is giving me a result something like:
// timeTotals .2 as expected
// totalTime 2.3939 ???
I can't imagine running the microtime(true) function is adding all that time... could it be? or is something happening in the background I am not aware of in between each function?