- microtime: documentation ( source)
<?php
$ms = microtime(true);
$array = array();
if (count($array) != 0)
{
foreach($array as $strings)
{
echo $strings;
}
}
echo 'Time taken: ' . (microtime(true) - $ms) . ' ms<br>'."\n";
$ms = microtime(true);
$array = array();
foreach($array as $strings)
{
echo $strings;
}
echo 'Time taken: ' . (microtime(true) - $ms) . ' ms<br>'."\n";
$ms = microtime(true);
$array = array('String', 'Not String');
if (count($array) != 0)
{
foreach($array as $strings)
{
echo $strings;
}
}
echo 'Time taken: ' . (microtime(true) - $ms) . ' ms<br>'."\n";
$ms = microtime(true);
$array = array('String', 'Not String');
foreach($array as $strings)
{
echo $strings;
}
echo 'Time taken: ' . (microtime(true) - $ms) . ' ms<br>'."\n";