Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?php
  2.  
  3. $string = 'hello world';
  4. $start_time = microtime();
  5. for ($i = 0; $i < $max = 10000000; $i++) {
  6. strtolower($string);
  7. }
  8. $timed = microtime() - $start_time;
  9. echo 'strtolower ' . $string . ' - ' . $timed . '<br>';
  10.  
  11. $string = 'hello world';
  12. $start_time = microtime();
  13. for ($i = 0; $i < $max = 10000000; $i++) {
  14. strtoupper($string);
  15. }
  16. $timed = microtime() - $start_time;
  17. echo 'strtoupper ' . $string . ' - ' . $timed . '<br>';
  18.  
  19. $string = 'HELLO WORLD';
  20. $start_time = microtime();
  21. for ($i = 0; $i < $max = 10000000; $i++) {
  22. strtolower($string);
  23. }
  24. $timed = microtime() - $start_time;
  25. echo 'strtolower ' . $string . ' - ' . $timed . '<br>';
  26.  
  27. $string = 'HELLO WORLD';
  28. $start_time = microtime();
  29. for ($i = 0; $i < $max = 10000000; $i++) {
  30. strtoupper($string);
  31. }
  32. $timed = microtime() - $start_time;
  33. echo 'strtoupper ' . $string . ' - ' . $timed . '<br>';
  34.  
  35. $string = 'Hello World';
  36. $start_time = microtime();
  37. for ($i = 0; $i < $max = 10000000; $i++) {
  38. strtolower($string);
  39. }
  40. $timed = microtime() - $start_time;
  41. echo 'strtolower ' . $string . ' - ' . $timed . '<br>';
  42.  
  43. $string = 'Hello World';
  44. $start_time = microtime();
  45. for ($i = 0; $i < $max = 10000000; $i++) {
  46. strtoupper($string);
  47. }
  48. $timed = microtime() - $start_time;
  49. echo 'strtoupper ' . $string . ' - ' . $timed . '<br>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement