public function getContent() { global $sql; $stmt = $sql->setCache('new_users')->query(' SELECT id, nickname, registered FROM ' . DB_PREFIX . 'users ORDER BY id DESC LIMIT 10'); if ($stmt) { $items = array(); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $items[$row['nickname']] = array(HREF . 'profile/' . $row['id'] . '/' . clean_url($row['nickname']), clock($row['registered'])); } return items($items); } else { return t('There is no content to display.'); } }
function report($name, $time) { static $last = null; printf("%-12s: %.8fms", $name, $time); if (null !== $last) { printf(", %.1f%%", ($time - $last) / $last * 100); } echo PHP_EOL; $last = $time; } // fixtures $a = str_repeat('a', 2 << 8); class O { public function strcmp($a) { strcmp($a, $a); } } // do it report('direct call', clock(function () use($a) { strcmp($a, $a); })); report('object call', clock(function () use($a) { $o = new O(); $o->strcmp($a); })); report('voodoo call', clock(function () use($a) { $o = unserialize('O:1:"O":0:{}'); $o->strcmp($a); }));
public function start() { return clock(new Clock()); }
function now() { return clock()->now(); }
public function stop() { return clock(new StoppedClock($this->now())); }