'; echo "About to run $what. "; flush(); //output this to the browser //$MYTIMER = microtime (true); //in PHP5 you need only this line to get the time list ($usec, $sec) = explode (' ', microtime()); $MYTIMER = ((float) $usec + (float) $sec); //set the timer } function StopTimer() { global $MYTIMER; if (!$MYTIMER) return; //no timer has been started list ($usec, $sec) = explode (' ', microtime()); //get the current time $MYTIMER = ((float) $usec + (float) $sec) - $MYTIMER; //the time taken in milliseconds echo '
Took ' . number_format ($MYTIMER, 4) . ' seconds.

'; flush(); } ?> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } $j = ""; StartTimer ('counting to 10.000.000'); for ($i=0; $i<10000000; $i++)//count to a high number { $j = $j . "a"; } StopTimer(); /* StartTimer('Selecting 349179 from bets'); $sql = "SELECT last_update FROM Bets"; $fixture_ids = $conn->prepare($sql); $fixture_ids->execute(); //print_r($fixture_ids); //$fixture_ids->setFetchMode(PDO::FETCH_ASSOC); StopTimer(); */ /* StartTimer ('printing 1kk string'); for ($i = 1; $i <= 10; $i++) { for ($c = 1; $c <= 1000000; $c++) echo $j[$i*$c]; echo "
"; } StopTimer(); */ ?>