Guest User

Untitled

a guest
Mar 19th, 2015
185
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $time_start = microtime(true);
  3. $now = new DateTime();
  4.  
  5. for($i=0;$i<50000;$i++){
  6.     $date = new DateTime('1993-11-17');
  7.     $interval = $now->diff($date);
  8.     $age = $interval->y.$interval->m.$interval->d;
  9. }
  10. $time_end = microtime(true);
  11. $time = $time_end - $time_start;
  12. echo "<br><center>time classes: ".$time."</center>";
  13.  
  14. $time_start = microtime(true);
  15. for($i=0;$i<50000;$i++){
  16. $ageY = date("Y")-1993;
  17. $ageM = date("n")-11;
  18. $ageD = date("j")-17;
  19. if($ageD < 0){
  20.     $ageD = $ageD += date("t");
  21.     $ageM--;
  22. }
  23. if($ageM < 0){
  24.     $ageM+=12;
  25.     $ageY--;
  26. }
  27. $age = $ageY."/".$ageM."/".$ageD;
  28.  
  29. }
  30. $time_end = microtime(true);
  31. $time = $time_end - $time_start;
  32. echo "<br><center>time functions: ".$time."</center>";
  33.  
  34. gc_disable();
  35.  
  36. $time_start = microtime(true);
  37. $now = new DateTime();
  38.  
  39. for($i=0;$i<50000;$i++){
  40.     $date = new DateTime('1993-11-17');
  41.     $interval = $now->diff($date);
  42.     $age = $interval->y.$interval->m.$interval->d;
  43. }
  44. $time_end = microtime(true);
  45. $time = $time_end - $time_start;
  46. echo "<br><center>time classes no gc: ".$time."</center>";
  47.  
  48. ?>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×