fork download
  1. <?php
  2.  
  3. $result = array
  4. (
  5. 'a' => 0,
  6. 'b' => 0,
  7. );
  8.  
  9. $b = 1;
  10.  
  11. for ($i = 0; $i < 1000; ++$i)
  12. {
  13. $t = microtime(true);
  14.  
  15. $a = array('a', 'b');
  16.  
  17. if ($b > 0)
  18. {
  19. $a[] = 'c';
  20. }
  21.  
  22. $result['a'] += microtime(true) - $t;
  23.  
  24. $t = microtime(true);
  25.  
  26. if ($b > 0)
  27. {
  28. $a = array('a', 'b', 'c');
  29. }
  30.  
  31. else
  32. {
  33. $a = array('a', 'b');
  34. }
  35.  
  36. $result['b'] += microtime(true) - $t;
  37. }
  38.  
  39. print_r($result);
Success #stdin #stdout 0.02s 13064KB
stdin
Standard input is empty
stdout
Array
(
    [a] => 0.00133728981018
    [b] => 0.00117683410645
)