// // Funcion que simula un cronometro // function cronometro($strVar,$reset = 'ok') { static $lapso = array(); static $start_time = array(); $thetime = 0; // Verificamos si esta definida la variable if(isset($lapso[$strVar])) { // Si existe, entonces, solo debemos parar el cronometro... $end_time[$strVar] = gettimeofday(); // ...y calcular el tiempo transcurrido $seg[$strVar] = $end_time[$strVar]['sec'] - $start_time[$strVar]['sec']; // Segundos transcurridos $microseg[$strVar] = ( ($seg[$strVar] * 1000000) + $end_time[$strVar]['usec'] ) - $start_time[$strVar]['usec']; // Microsegundos Transcurridos $lapso[$strVar] = $microseg[$strVar] / 1000000; // Final Time in seg $thetime = $lapso[$strVar]; } else { // Si no existe, entonces iniciamos un nuevo cronometro $lapso[$strVar] = 0.00000; $start_time[$strVar] = gettimeofday(); $thetime = $lapso[$strVar]; } // Si el Flag reset no es 'anulado' if(is_null($reset)) { // Si el flag reset se activo, entonces destruimos todas las variables // cuya clave es $strVar unset($lapso[$strVar]); unset($start_time[$strVar]); /* echo '
'; print_r($lapso) . ''; */ } return $thetime; } // SI MAS ABAJO APARECE ALGO, ELIMINALO, SOLO SERA PUBLICIDAD . . .
'; print_r($start_time) . '
'; echo '