Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




timer_stop [ WordPress Function ]

timer_stop ( $display = 0, $precision = 3 )
Parameters:
  • (int) $display Use '0' or null to not echo anything and 1 to echo the total time
  • (int) $precision The amount of digits from the right of the decimal to display. Default is 3.
Returns:
  • (float) The "second.microsecond" finished time calculation
Defined at:



Return and/or display the time from the page start to when function is called.

You can get the results and print them by doing:

$nTimePageTookToExecute = timer_stop();
echo $nTimePageTookToExecute;

Or instead, you can do:

timer_stop(1);

which will do what the above does. If you need the result, you can assign it to a variable, but in most cases, you only need to echo it.

Source


<?php
function timer_stop$display 0$precision ) { // if called like timer_stop(1), will echo $timetotal
    
global $timestart$timeend;
    
$timeend microtimetrue );
    
$timetotal $timeend $timestart;
    
$r = ( function_exists'number_format_i18n' ) ) ? number_format_i18n$timetotal$precision ) : number_format$timetotal$precision );
    if ( 
$display )
        echo 
$r;
    return 
$r;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics