- microtime: documentation ( source)
- range: documentation ( source)
- printf: documentation ( source)
<?php
$array = range(1,100000);
$start = microtime(true);
foreach ($array as $key => $value) {
$array[$key] += 1; // Invokes COW
}
$end = microtime(true);
$time = $end - $start;
printf("Completed in %.6f seconds\n", $time);