本文整理汇总了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";