- microtime: documentation ( source)
- round: documentation ( source)
<?php
class base {} ;
class foo extends base {
protected $a;
public function __construct(){
$a = get_called_class();
}
}
class bar extends base {
protected $a;
public function __construct(){
$a = get_class($this);
}
}
$time = microtime(true);
for($x=0;$x<10000;$x++){
$foo = new foo();
}
echo round(microtime(true) - $time, 5)." s\n";
$time = microtime(true);
for($x=0;$x<10000;$x++){
$foo = new bar();
}
echo round(microtime(true) - $time, 5)." s\n";