Title: timer_stop
Published: April 25, 2014
Last modified: February 24, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#wp--skip-link--target)

Retrieves or displays the time from the page start to when function is called.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#parameters)󠁿

 `$display`int|boolrequired

Whether to echo or return the results. Accepts `0|false` for return, `1|true` for
echo. Default `0|false`.

`$precision`intoptional

The number of digits from the right of the decimal to display.

Default:`3`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#return)󠁿

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

## 󠀁[Source](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#source)󠁿

    ```php
    function timer_stop( $display = 0, $precision = 3 ) {
    	global $timestart, $timeend;

    	$timeend   = microtime( true );
    	$timetotal = $timeend - $timestart;

    	if ( function_exists( 'number_format_i18n' ) ) {
    		$r = number_format_i18n( $timetotal, $precision );
    	} else {
    		$r = number_format( $timetotal, $precision );
    	}

    	if ( $display ) {
    		echo $r;
    	}

    	return $r;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/load.php#L527)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/load.php#L527-L544)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#related)󠁿

| Uses | Description | 
| [number_format_i18n()](https://developer.wordpress.org/reference/functions/number_format_i18n/)`wp-includes/functions.php` |

Converts float number to format based on the locale.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#changelog)󠁿

| Version | Description | 
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#comment-content-1500)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/timer_stop/#comment-1500)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ftimer_stop%2F%23comment-1500)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ftimer_stop%2F%23comment-1500)
 4.  **Determine length of time to render page with a precision of 3, 5 and 10 digits.**
 5.      ```php
         echo( 'Seconds: ' . timer_stop( 0 ) . '<br />' );
         echo( 'Seconds: ' . timer_stop( 0, 5 ) . '<br />' );
         echo( 'Seconds: ' . timer_stop( 0, 10 ) . '<br />' );
         ```
     
 6.  Output:
 7.      ```php
         Seconds: 0.815
         Seconds: 0.81551
         Seconds: 0.8155429363
         ```
     
 8.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ftimer_stop%2F%3Freplytocom%3D1500%23feedback-editor-1500)
 9.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/timer_stop/?output_format=md#comment-content-3484)
 10.   [ashour](https://profiles.wordpress.org/ashour/)  [  6 years ago  ](https://developer.wordpress.org/reference/functions/timer_stop/#comment-3484)
 11. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ftimer_stop%2F%23comment-3484)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ftimer_stop%2F%23comment-3484)
 12. Check the Pages load Time in seconds
 13.     ```php
         add_action( 'wp_footer', function() {
             echo '<br/>' . 'The page is loaded in ' . timer_stop() . ' seconds <br/>';
         }, PHP_INT_MAX );
         ```
     
 14.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ftimer_stop%2F%3Freplytocom%3D3484%23feedback-editor-3484)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ftimer_stop%2F)
before being able to contribute a note or feedback.