On this page
timer_stop( int|bool $display, int $precision = 3 ): string
Retrieve or display the time from the page start to when function is called.
Parameters
$displayint|bool Required-
Whether to echo or return the results. Accepts
0|falsefor return,1|truefor echo. Default0|false. $precisionint Optional-
The number of digits from the right of the decimal to display.
Default:
3
Return
string The "second.microsecond" finished time calculation. The number is formatted for human consumption, both localized and rounded.
Source
File: wp-includes/load.php. View all references
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
Uses
| Uses | Description |
|---|---|
| number_format_i18n() wp-includes/functions.php | Converts float number to format based on the locale. |
Changelog
| Version | Description |
|---|---|
| 0.71 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/timer_stop