Tema: microtime()
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/03/2008, 06:36
Avatar de emiliodeg
emiliodeg
 
Fecha de Ingreso: septiembre-2005
Ubicación: Córdoba
Mensajes: 1.830
Antigüedad: 18 años, 8 meses
Puntos: 55
Re: microtime()

revisa estos ejemplos que deja el manual de php

Ejemplo 1. Medición del tiempo de ejecución del script con microtime()
<?php
/**
* Funcion simple para replicar el comportamiento en PHP 5
*/
function microtime_float()
{
list(
$useg, $seg) = explode(" ", microtime());
return ((float)
$useg + (float)$seg);
}

$tiempo_inicio = microtime_float();

// Dormir por un momento
usleep(100);

$tiempo_final = microtime_float();
$tiempo = $tiempo_final - $tiempo_inicio;

echo
"No hice nada en $tiempo segundos\n";
?>
Ejemplo 2. Medición del tiempo de ejecución del script en PHP 5
<?php
$tiempo_inicio
= microtime(true);

// Dormir por un momento
usleep(100);

$tiempo_final = microtime(true);
$tiempo = $tiempo_final - $tiempo_inicio;

echo
"No hice nada en $tiempo segundos\n";
?>
__________________
Degiovanni Emilio
developtus.com