timer_stop

函数
timer_stop ( $display = 0, $precision = 3 )
参数
  • (int|bool) $display Whether to echo or return the results. Accepts 0|false for return, 1|true for echo. Default 0|false.
    Required:
  • (int) $precision The number of digits from the right of the decimal to display. Default 3.
    Required:
    Default: 3
返回值
  • (string) The "second.microsecond" finished time calculation. The number is formatted for human consumption, both localized and rounded.
定义位置
相关方法
timer_starttimer_floatterm_existsthe_postget_importers
引入
0.71
弃用
-

timer_stop:该函数停止使用timer_start函数启动的定时器,并返回以秒为单位的经过时间。

检索或显示从页面开始到函数被调用的时间。

function timer_stop( $display = 0, $precision = 3 ) {
	global $timestart, $timeend;
	$timeend   = microtime( true );
	$timetotal = $timeend - $timestart;
	$r         = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
	if ( $display ) {
		echo $r;
	}
	return $r;
}

常见问题

FAQs
查看更多 >