本文整理匯總了PHP中format::time_seconds方法的典型用法代碼示例。如果您正苦於以下問題:PHP format::time_seconds方法的具體用法?PHP format::time_seconds怎麽用?PHP format::time_seconds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類format
的用法示例。
在下文中一共展示了format::time_seconds方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: benchmark
/**
* Benchmark
*
* @staticvar type $start
* @staticvar int $total
* @param string $name
*/
public static function benchmark($name = '')
{
if (self::$debug) {
static $start = NULL;
static $total = 0;
$benchmark = 0;
if (is_null($start)) {
$start = self::get_microtime();
} else {
$temp = self::get_microtime();
$benchmark = $temp - $start;
$start = $temp;
}
$total += $benchmark;
self::$data['benchmark'][] = ['name' => $name, 'time' => format::time_seconds($benchmark) . '', 'total' => format::time_seconds($total), 'start' => format::datetime($start), 'memory' => memory_get_peak_usage(true)];
}
}
示例2: foreach
// we need to reset all caches
if ($mode == 'commit') {
$cache = factory::get(['cache']);
if (!empty($cache)) {
foreach ($cache as $k => $v) {
$object = $v['object'];
$object->gc(2);
}
}
}
break;
case 'dependency':
default:
$result = system_dependencies::process_deps_all(['mode' => $mode]);
}
// hint
if (!empty($result['hint'])) {
echo implode("\n", $result['hint']) . "\n";
}
// if we did not succede
if (!$result['success']) {
echo implode("\n", $result['error']) . "\n";
exit;
}
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
// benchmark
$seconds = format::time_seconds(microtime(true) - $benchmark);
// if we succedded
echo "\nOperation \"{$type}\" with mode \"{$mode}\" completed in {$seconds} seconds!\n";