3v4l.org

run code in 300+ PHP versions simultaneously
<?php $parameters = array(); $lines = range(1,1000); $start = microtime(true); while ($name = array_shift($lines)) { $parameters[$name] = array_shift($lines); } $end = microtime(true); echo ($end-$start)." (while loop)\n"; $parameters2 = array(); $lines2 = range(1,1000); $start = microtime(true); $linescount = count($lines2); for($i = 0; $i < $linescount; $i++){ $name = $lines2[$i]; $i++; $parameters2[$name] = $lines2[$i]; } $end = microtime(true); echo ($end-$start)." (for loop)\n"; if($parameters === $parameters2){ echo "they are equal\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 11
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 42
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 61
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 42
Branch analysis from position: 51
Branch analysis from position: 42
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 11
Branch analysis from position: 21
Branch analysis from position: 11
filename:       /in/9hoQT
function name:  (null)
number of ops:  62
compiled vars:  !0 = $parameters, !1 = $lines, !2 = $start, !3 = $name, !4 = $end, !5 = $parameters2, !6 = $lines2, !7 = $linescount, !8 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 1000
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !1, $10
    5     6        INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $12     
          9        ASSIGN                                                   !2, $12
    6    10      > JMP                                                      ->16
    7    11    >   INIT_FCALL                                               'array_shift'
         12        SEND_REF                                                 !1
         13        DO_ICALL                                         $15     
         14        ASSIGN_DIM                                               !0, !3
         15        OP_DATA                                                  $15
    6    16    >   INIT_FCALL                                               'array_shift'
         17        SEND_REF                                                 !1
         18        DO_ICALL                                         $16     
         19        ASSIGN                                           ~17     !3, $16
         20      > JMPNZ                                                    ~17, ->11
    9    21    >   INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $18     
         24        ASSIGN                                                   !4, $18
   10    25        SUB                                              ~20     !4, !2
         26        CONCAT                                           ~21     ~20, '+%28while+loop%29%0A'
         27        ECHO                                                     ~21
   12    28        ASSIGN                                                   !5, <array>
   13    29        INIT_FCALL                                               'range'
         30        SEND_VAL                                                 1
         31        SEND_VAL                                                 1000
         32        DO_ICALL                                         $23     
         33        ASSIGN                                                   !6, $23
   14    34        INIT_FCALL                                               'microtime'
         35        SEND_VAL                                                 <true>
         36        DO_ICALL                                         $25     
         37        ASSIGN                                                   !2, $25
   15    38        COUNT                                            ~27     !6
         39        ASSIGN                                                   !7, ~27
   16    40        ASSIGN                                                   !8, 0
         41      > JMP                                                      ->49
   17    42    >   FETCH_DIM_R                                      ~30     !6, !8
         43        ASSIGN                                                   !3, ~30
   18    44        PRE_INC                                                  !8
   19    45        FETCH_DIM_R                                      ~34     !6, !8
         46        ASSIGN_DIM                                               !5, !3
         47        OP_DATA                                                  ~34
   16    48        PRE_INC                                                  !8
         49    >   IS_SMALLER                                               !8, !7
         50      > JMPNZ                                                    ~36, ->42
   21    51    >   INIT_FCALL                                               'microtime'
         52        SEND_VAL                                                 <true>
         53        DO_ICALL                                         $37     
         54        ASSIGN                                                   !4, $37
   22    55        SUB                                              ~39     !4, !2
         56        CONCAT                                           ~40     ~39, '+%28for+loop%29%0A'
         57        ECHO                                                     ~40
   24    58        IS_IDENTICAL                                             !0, !5
         59      > JMPZ                                                     ~41, ->61
   25    60    >   ECHO                                                     'they+are+equal%0A'
   26    61    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.12 ms | 1400 KiB | 19 Q