Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?PHP
  2.  
  3. function microtime_float(){
  4.  
  5. list($useg, $seg) = explode(" ", microtime());
  6. return ((float)$useg + (float)$seg);
  7. }
  8.  
  9. $tiempo_inicio = microtime_float();
  10.  
  11. /* inicio del algoritmo de ordenación */
  12.  
  13. /* aqui va el algoritmo a observar*/
  14.  
  15. /* Fin del algoritmo de ordenación */
  16.  
  17. $tiempo_fin = microtime_float();
  18. $tiempo = $tiempo_fin - $tiempo_inicio;
  19.  
  20. echo "Tiempo empleado: " . ($tiempo_fin - $tiempo_inicio);
  21.  
  22. ?>
  23.  
  24. 1 2 3 4 5 Tiempo empleado: 4.8160552978516
  25. 1 2 3 4 5 Tiempo empleado: 3.0994415283203
  26. 1 2 3 4 5 Tiempo empleado: 9.0122222900391
  27. 1 2 3 4 5 Tiempo empleado: 5.5074691772461
  28. etc, etc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement