< >

scriptlaufzeitphp.php


Quell Code


<?php


function startTime(){
    
    //$timeExplode = explode(" ", microtime());
    $time = microtime();//$timeExplode[1] + $timeExplode[0];

    return $time;

}

function endTime($timer){

    $timeExplode = microtime();//explode(" ", microtime());
    //$time = $timeExplode[1] + $timeExplode[0];
    $finish = $time - $timeExplode;
    $endTime = sprintf("%4.3f", $finish); 
  
    return $endTime;

}

// Startet den Timer
$timer = startTime();

for($x=0;$x<100000000;$x++){
$d=$x*$x+$x;
}
//echo $d;
// Beendet den Timer
$endTime = endTime($timer);

echo $endTime . ' Sekunden';
?>