WordPress at Your Fingertips

timer_stop() WP 1.0

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

No Hooks.


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


timer_stop( $display, $precision );
Whether to echo or return the results. Accepts 0|false for return,
1|true for echo.
Default: 0|false
The number of digits from the right of the decimal to display.
Default: 3


  • Global. float. $timestart Seconds from when timer_start() is called.
  • Global. float. $timeend Seconds from when function is called.


Since 0.71 Introduced.

Code of timer_stop() WP 5.7.2

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;

From tag: debug

More from category: Helper Functions

No comments
    Log In