- microtime: documentation ( source)
- spl_object_hash: documentation ( source)
- printf: documentation ( source)
<?php
$times = 1000 * 100;
$obj = new stdClass;
$time = microtime(true);
for ($i = 0; $i <= $times; $i++)
echo spl_object_hash($obj);
$time = microtime(true) - $time;
printf('spl_object_hash: %.4f', $time);
$time = microtime(true);
for ($i = 0; $i <= $times; $i++)
echo get_class($obj);
$time = microtime(true) - $time;
printf('get_class: %.4f', $time);