daily pastebin goal
59%
SHARE
TWEET

Sam Yong

a guest Oct 11th, 2009 557 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function microtime_float(){
  4.     list($usec, $sec) = explode(" ", microtime());
  5.     return ((float)$usec + (float)$sec);
  6. }
  7.  
  8. $file = 'favicon.ico';
  9.  
  10. $u = 100;
  11. $time_start = microtime_float();
  12.  
  13. while($u-- > 0){
  14. $data = file_get_contents($file);
  15. }
  16.  
  17. $time_end = microtime_float();
  18. $loadedin = (float)($time_end - $time_start);
  19. echo $loadedin.' seconds<br/>';
  20.  
  21. $u = 100;
  22. $time_start = microtime_float();
  23.  
  24. while($u-- > 0){
  25. $fh=fopen($file, "r" );
  26. if($fh){
  27. while (!feof($fh)){
  28. $data.= fread($fh, 4096);
  29. }
  30. fclose($fh);
  31. }
  32. }
  33.  
  34. $time_end = microtime_float();
  35. $loadedin = (float)($time_end - $time_start);
  36. echo $loadedin.' seconds<br/>';
  37.  
  38. ?>
RAW Paste Data
Top