- hrtime: documentation ( source)
<?php
$array = [];
$t1 = hrtime(true);
for ($i = 0; $i < 6000000; $i++) {
\array_key_exists("key", $array);
}
$t2 = hrtime(true);
$t3 = hrtime(true);
for ($i = 0; $i < 6000000; $i++) {
isset($array["key"]);
}
$t4 = hrtime(true);
echo "With function: " . (($t2 - $t1) / 1000000) . " ms\n";
echo "With isset : " . (($t4 - $t3) / 1000000) . " ms\n";