<?php
include_once('class.stoper.php');
$s = new Stoper();
echo 'starting...<br>';
$s->Start();
// something not important
for ($i = 0; $i < 1000000; $i++) {
$digit = rand(0, 100);
}
// end of "not important"
$s->MidTimeStart();
for ($i = 0; $i < 1000000; $i++) {
$letter = chr(rand(97, 122));
$digit = ord($letter);
}
echo $s->showResult('Million "for" loop: ').'<br>';
// again: not important array creation
$arr = array(12, 1654, 6515, 5156, 51, 654, 654, 684, 6516, 8455, 4868);
// end of "not important"
$s->MidTimeStart();
for ($i = 0; $i < 1000000; $i++) {
sort($arr);
rsort($arr);
}
echo $s->showResult('Million array sorting: ').'<br>';
$s->Stop();
echo $s->showResult('Full execution time: ').'<br>';
?>
|