wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



timer_stop › WordPress Function

Seit0.71
Veraltetn/v
timer_stop ( $display = 0, $precision = 3 )
Parameter: (2)
  • (int|bool) $display Whether to echo or return the results. Accepts 0|false for return, 1|true for echo. Default 0|false.
    Erforderlich: Nein
    Standard:
  • (int) $precision The number of digits from the right of the decimal to display. Default 3.
    Erforderlich: Nein
    Standard: 3
Gibt zurück:
  • (string) The "second.microsecond" finished time calculation. The number is formatted for human consumption, both localized and rounded.
Definiert in:
Codex:

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



Quellcode

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;
}