timer_stop() WordPress Function

The timer_stop() function is used to stop the specified timer. If no timer is specified, then the current timer will be stopped.

timer_stop( int|bool $display, int $precision = 3 ) #

Retrieve or display the time from the page start to when function is called.


Parameters

$display

(int|bool)(Required)Whether to echo or return the results. Accepts 0|false for return, 1|true for echo. Default 0|false.

$precision

(int)(Optional)The number of digits from the right of the decimal to display.

Default value: 3


Top ↑

Return

(string) The "second.microsecond" finished time calculation. The number is formatted for human consumption, both localized and rounded.


Top ↑

Source

File: wp-includes/load.php

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;
}


Top ↑

Changelog

Changelog
VersionDescription
0.71Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.