WordPress at a glance

timer_stop() WP 1.0

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

  • Global. float. $timestart Seconds from when timer_start() is called.
  • Global. float. $timeend Seconds from 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

Code of timer stop: wp-includes/load.php WP 5.2.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;

Related Functions

From tag: debug

More from category: Helper Functions

No comments
    Hello, !     Log In . Register