3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); // The original function function a($i){$e=microtime(1)+$i;while(microtime(1)<$e);} // Use 'for' instead of 'while' function b($i){for($e=microtime(1)+$i;microtime(1)<$e;);} // Extract 'microtime' into a variable function c($i){for($f=microtime,$e=$f(1)+$i;$f(1)<$e;);} //var_dump(PHP_VERSION_ID); exit(); // PHP 7 only: initialize $f on its first use //if (70000 <= PHP_VERSION_ID) { // function d($i){for($e=($f=microtime)(1)+$i;$f(1)<$e;);} //} // Test $t0 = microtime(true); a(1); $ta = microtime(true); b(1); $tb = microtime(true); c(1); $tc = microtime(true); if (70000 <= PHP_VERSION_ID) { // d(1); } $td = microtime(true); printf("a(): %.6f\n", $ta-$t0); printf("b(): %.6f\n", $tb-$ta); printf("c(): %.6f\n", $tc-$tb); if (70000 <= PHP_VERSION_ID) { // printf("d(): %.6f\n", $td-$tc); } else { printf("d(): N/A\n"); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 29
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 50
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/jlPAd
function name:  (null)
number of ops:  54
compiled vars:  !0 = $t0, !1 = $ta, !2 = $tb, !3 = $tc, !4 = $td
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                                 
   22     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !0, $6
   23     7        INIT_FCALL                                               'a'
          8        SEND_VAL                                                 1
          9        DO_FCALL                                      0          
   24    10        INIT_FCALL                                               'microtime'
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !1, $9
   25    14        INIT_FCALL                                               'b'
         15        SEND_VAL                                                 1
         16        DO_FCALL                                      0          
   26    17        INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $12     
         20        ASSIGN                                                   !2, $12
   27    21        INIT_FCALL                                               'c'
         22        SEND_VAL                                                 1
         23        DO_FCALL                                      0          
   28    24        INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $15     
         27        ASSIGN                                                   !3, $15
   29    28      > JMPZ                                                     <true>, ->29
   32    29    >   INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $17     
         32        ASSIGN                                                   !4, $17
   35    33        INIT_FCALL                                               'printf'
         34        SEND_VAL                                                 'a%28%29%3A+%25.6f%0A'
         35        SUB                                              ~19     !1, !0
         36        SEND_VAL                                                 ~19
         37        DO_ICALL                                                 
   36    38        INIT_FCALL                                               'printf'
         39        SEND_VAL                                                 'b%28%29%3A+%25.6f%0A'
         40        SUB                                              ~21     !2, !1
         41        SEND_VAL                                                 ~21
         42        DO_ICALL                                                 
   37    43        INIT_FCALL                                               'printf'
         44        SEND_VAL                                                 'c%28%29%3A+%25.6f%0A'
         45        SUB                                              ~23     !3, !2
         46        SEND_VAL                                                 ~23
         47        DO_ICALL                                                 
   38    48      > JMPZ                                                     <true>, ->50
         49    > > JMP                                                      ->53
   41    50    >   INIT_FCALL                                               'printf'
         51        SEND_VAL                                                 'd%28%29%3A+N%2FA%0A'
         52        DO_ICALL                                                 
   42    53    > > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 7
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/jlPAd
function name:  a
number of ops:  13
compiled vars:  !0 = $i, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 1
          3        DO_ICALL                                         $2      
          4        ADD                                              ~3      $2, !0
          5        ASSIGN                                                   !1, ~3
          6      > JMP                                                      ->7
          7    >   INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 1
          9        DO_ICALL                                         $5      
         10        IS_SMALLER                                               $5, !1
         11      > JMPNZ                                                    ~6, ->7
         12    > > RETURN                                                   null

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 7
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/jlPAd
function name:  b
number of ops:  13
compiled vars:  !0 = $i, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 1
          3        DO_ICALL                                         $2      
          4        ADD                                              ~3      $2, !0
          5        ASSIGN                                                   !1, ~3
          6      > JMP                                                      ->7
          7    >   INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 1
          9        DO_ICALL                                         $5      
         10        IS_SMALLER                                               $5, !1
         11      > JMPNZ                                                    ~6, ->7
         12    > > RETURN                                                   null

End of function b

Function c:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 9
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/jlPAd
function name:  c
number of ops:  15
compiled vars:  !0 = $i, !1 = $f, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        FETCH_CONSTANT                                   ~3      'microtime'
          2        ASSIGN                                                   !1, ~3
          3        INIT_DYNAMIC_CALL                                        !1
          4        SEND_VAL_EX                                              1
          5        DO_FCALL                                      0  $5      
          6        ADD                                              ~6      $5, !0
          7        ASSIGN                                                   !2, ~6
          8      > JMP                                                      ->9
          9    >   INIT_DYNAMIC_CALL                                        !1
         10        SEND_VAL_EX                                              1
         11        DO_FCALL                                      0  $8      
         12        IS_SMALLER                                               $8, !2
         13      > JMPNZ                                                    ~9, ->9
         14    > > RETURN                                                   null

End of function c

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.65 ms | 1411 KiB | 22 Q