- microtime: documentation ( source)
- number_format: documentation ( source)
<?php
class Model {
private $id;
public function setId($id)
{
$this->id = $id;
}
}
$time = microtime(true);
for ($i = 0; $i < 500000; $i++) {
$model = new Model;
$method = 'setId';
call_user_func_array(array($model, $method), array('test'));
}
$time = microtime(true) - $time;
echo 'call user func took ' . number_format($time, 3) . ' seconds and returned ' . count($data_diff1) . " entries\n";