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函式啟動的定時器,並返回以秒為單位的經過時間。

檢索或顯示從頁面開始到函式被呼叫的時間。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
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; }
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
檢視更多 >