3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array_fill(0, 100000, 'hello'); $start = microtime(true); foreach ($arr as $ar) {} echo 'Array Iteration :' . round(microtime(true) - $start, 4) . "\n"; $arr = SplFixedArray::fromArray($arr); $start = microtime(true); foreach ($arr as $ar) {} echo 'SPL Iteration :' . round(microtime(true) - $start, 4) . "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 13
filename:       /in/XLZFQ
function name:  (null)
number of ops:  49
compiled vars:  !0 = $arr, !1 = $start, !2 = $ar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'array_fill'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 100000
          3        SEND_VAL                                                 'hello'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
    6     6        INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !1, $5
    7    10      > FE_RESET_R                                       $7      !0, ->13
         11    > > FE_FETCH_R                                               $7, !2, ->13
         12    > > JMP                                                      ->11
         13    >   FE_FREE                                                  $7
    8    14        INIT_FCALL                                               'round'
         15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $8      
         18        SUB                                              ~9      $8, !1
         19        SEND_VAL                                                 ~9
         20        SEND_VAL                                                 4
         21        DO_ICALL                                         $10     
         22        CONCAT                                           ~11     'Array+Iteration+%3A', $10
         23        CONCAT                                           ~12     ~11, '%0A'
         24        ECHO                                                     ~12
   10    25        INIT_STATIC_METHOD_CALL                                  'SplFixedArray', 'fromArray'
         26        SEND_VAR                                                 !0
         27        DO_FCALL                                      0  $13     
         28        ASSIGN                                                   !0, $13
   11    29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $15     
         32        ASSIGN                                                   !1, $15
   12    33      > FE_RESET_R                                       $17     !0, ->36
         34    > > FE_FETCH_R                                               $17, !2, ->36
         35    > > JMP                                                      ->34
         36    >   FE_FREE                                                  $17
   13    37        INIT_FCALL                                               'round'
         38        INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $18     
         41        SUB                                              ~19     $18, !1
         42        SEND_VAL                                                 ~19
         43        SEND_VAL                                                 4
         44        DO_ICALL                                         $20     
         45        CONCAT                                           ~21     'SPL+Iteration+%3A', $20
         46        CONCAT                                           ~22     ~21, '%0A'
         47        ECHO                                                     ~22
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.12 ms | 1400 KiB | 19 Q