3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cnt = 100000; echo "range()\n"; $mc = microtime(true); for($x=0; $x<=$cnt; $x++) { foreach ([...range(1, 48), ...range(114, 118)] as $number) { #echo "$number "; } } echo round(microtime(true)-$mc,4)."\n"; # ----------------------------------- echo "for loop\n"; $mc = microtime(true); for($x=0; $x<=$cnt; $x++) { for ($y=1; $y < 118; $y++) { if (($y>=1 && $y<=48) || ($y>=115 && $y <=117)) { #echo $y . " " ; } else { // do nothing } } } echo round(microtime(true)-$mc,4)."\n"; # ----------------------------------- function printRange(int $from, int $to) { for($i=$from; $i<=$to; $i++) { #echo "$i "; } } echo "function calls\n"; $mc = microtime(true); for($x=0; $x<=$cnt; $x++) { printRange(1, 48); printRange(114, 118); } echo round(microtime(true)-$mc,4)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 8
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 63, Position 2 = 43
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 89
Branch analysis from position: 89
2 jumps found. (Code = 44) Position 1 = 91, Position 2 = 80
Branch analysis from position: 91
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 80
2 jumps found. (Code = 44) Position 1 = 91, Position 2 = 80
Branch analysis from position: 91
Branch analysis from position: 80
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 45
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 63, Position 2 = 43
Branch analysis from position: 63
Branch analysis from position: 43
Branch analysis from position: 45
2 jumps found. (Code = 46) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
2 jumps found. (Code = 47) Position 1 = 50, Position 2 = 55
Branch analysis from position: 50
2 jumps found. (Code = 46) Position 1 = 52, Position 2 = 54
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 57
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 45
Branch analysis from position: 60
Branch analysis from position: 45
Branch analysis from position: 57
Branch analysis from position: 54
Branch analysis from position: 55
Branch analysis from position: 49
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 8
Branch analysis from position: 26
Branch analysis from position: 8
Branch analysis from position: 22
filename:       /in/DFm3o
function name:  (null)
number of ops:  102
compiled vars:  !0 = $cnt, !1 = $mc, !2 = $x, !3 = $number, !4 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 100000
    5     1        ECHO                                                     'range%28%29%0A'
    6     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
    7     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->24
    9     8    >   INIT_FCALL                                               'range'
          9        SEND_VAL                                                 1
         10        SEND_VAL                                                 48
         11        DO_ICALL                                         $9      
         12        INIT_ARRAY                                       ~10     
         13        ADD_ARRAY_UNPACK                                 ~10     $9
         14        INIT_FCALL                                               'range'
         15        SEND_VAL                                                 114
         16        SEND_VAL                                                 118
         17        DO_ICALL                                         $11     
         18        ADD_ARRAY_UNPACK                                 ~10     $11
         19      > FE_RESET_R                                       $12     ~10, ->22
         20    > > FE_FETCH_R                                               $12, !3, ->22
         21    > > JMP                                                      ->20
         22    >   FE_FREE                                                  $12
    7    23        PRE_INC                                                  !2
         24    >   IS_SMALLER_OR_EQUAL                                      !2, !0
         25      > JMPNZ                                                    ~14, ->8
   13    26    >   INIT_FCALL                                               'round'
         27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $15     
         30        SUB                                              ~16     $15, !1
         31        SEND_VAL                                                 ~16
         32        SEND_VAL                                                 4
         33        DO_ICALL                                         $17     
         34        CONCAT                                           ~18     $17, '%0A'
         35        ECHO                                                     ~18
   17    36        ECHO                                                     'for+loop%0A'
   18    37        INIT_FCALL                                               'microtime'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $19     
         40        ASSIGN                                                   !1, $19
   19    41        ASSIGN                                                   !2, 0
         42      > JMP                                                      ->61
   22    43    >   ASSIGN                                                   !4, 1
         44      > JMP                                                      ->58
   23    45    >   IS_SMALLER_OR_EQUAL                              ~23     1, !4
         46      > JMPZ_EX                                          ~23     ~23, ->49
         47    >   IS_SMALLER_OR_EQUAL                              ~24     !4, 48
         48        BOOL                                             ~23     ~24
         49    > > JMPNZ_EX                                         ~23     ~23, ->55
         50    >   IS_SMALLER_OR_EQUAL                              ~25     115, !4
         51      > JMPZ_EX                                          ~25     ~25, ->54
         52    >   IS_SMALLER_OR_EQUAL                              ~26     !4, 117
         53        BOOL                                             ~25     ~26
         54    >   BOOL                                             ~23     ~25
         55    > > JMPZ                                                     ~23, ->57
         56    > > JMP                                                      ->57
   22    57    >   PRE_INC                                                  !4
         58    >   IS_SMALLER                                               !4, 118
         59      > JMPNZ                                                    ~28, ->45
   19    60    >   PRE_INC                                                  !2
         61    >   IS_SMALLER_OR_EQUAL                                      !2, !0
         62      > JMPNZ                                                    ~30, ->43
   31    63    >   INIT_FCALL                                               'round'
         64        INIT_FCALL                                               'microtime'
         65        SEND_VAL                                                 <true>
         66        DO_ICALL                                         $31     
         67        SUB                                              ~32     $31, !1
         68        SEND_VAL                                                 ~32
         69        SEND_VAL                                                 4
         70        DO_ICALL                                         $33     
         71        CONCAT                                           ~34     $33, '%0A'
         72        ECHO                                                     ~34
   42    73        ECHO                                                     'function+calls%0A'
   43    74        INIT_FCALL                                               'microtime'
         75        SEND_VAL                                                 <true>
         76        DO_ICALL                                         $35     
         77        ASSIGN                                                   !1, $35
   44    78        ASSIGN                                                   !2, 0
         79      > JMP                                                      ->89
   46    80    >   INIT_FCALL                                               'printrange'
         81        SEND_VAL                                                 1
         82        SEND_VAL                                                 48
         83        DO_FCALL                                      0          
   47    84        INIT_FCALL                                               'printrange'
         85        SEND_VAL                                                 114
         86        SEND_VAL                                                 118
         87        DO_FCALL                                      0          
   44    88        PRE_INC                                                  !2
         89    >   IS_SMALLER_OR_EQUAL                                      !2, !0
         90      > JMPNZ                                                    ~41, ->80
   49    91    >   INIT_FCALL                                               'round'
         92        INIT_FCALL                                               'microtime'
         93        SEND_VAL                                                 <true>
         94        DO_ICALL                                         $42     
         95        SUB                                              ~43     $42, !1
         96        SEND_VAL                                                 ~43
         97        SEND_VAL                                                 4
         98        DO_ICALL                                         $44     
         99        CONCAT                                           ~45     $44, '%0A'
        100        ECHO                                                     ~45
        101      > RETURN                                                   1

Function printrange:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 4
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 4
Branch analysis from position: 7
Branch analysis from position: 4
filename:       /in/DFm3o
function name:  printRange
number of ops:  8
compiled vars:  !0 = $from, !1 = $to, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   37     2        ASSIGN                                                   !2, !0
          3      > JMP                                                      ->5
          4    >   PRE_INC                                                  !2
          5    >   IS_SMALLER_OR_EQUAL                                      !2, !1
          6      > JMPNZ                                                    ~5, ->4
   40     7    > > RETURN                                                   null

End of function printrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.33 ms | 1022 KiB | 18 Q