3v4l.org

run code in 300+ PHP versions simultaneously
<?php $all = []; for( $i=0; $i<2000; $i++ ) { for( $j=0; $j<500; $j++ ) { $all[$i][$j] = $j; } } $mergedArray = []; $start = microtime(true); foreach($all as &$templateClosingArray) { $mergedArray += $templateClosingArray; } $mergedArray = []; foreach($all as &$templateClosingArray) { $mergedArray += $templateClosingArray; } $mergedArray = []; foreach($all as &$templateClosingArray) { $mergedArray += $templateClosingArray; } $end = microtime(true); echo PHP_EOL . 'Union time: ' . $end; $start = microtime(true); $mergedArray = []; $mergedArray = array_merge(...$all); $mergedArray = []; $mergedArray = array_merge(...$all); $mergedArray = []; $mergedArray = array_merge(...$all); $end = microtime(true); echo PHP_EOL . 'Array merge time: ' . $end;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
2 jumps found. (Code = 125) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
2 jumps found. (Code = 126) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 23
2 jumps found. (Code = 125) Position 1 = 26, Position 2 = 29
Branch analysis from position: 26
2 jumps found. (Code = 126) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 29
2 jumps found. (Code = 125) Position 1 = 32, Position 2 = 35
Branch analysis from position: 32
2 jumps found. (Code = 126) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
Branch analysis from position: 29
Branch analysis from position: 23
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 5
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
Branch analysis from position: 3
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 5
Branch analysis from position: 11
Branch analysis from position: 5
filename:       /in/6NNSP
function name:  (null)
number of ops:  71
compiled vars:  !0 = $all, !1 = $i, !2 = $j, !3 = $mergedArray, !4 = $start, !5 = $templateClosingArray, !6 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->12
    5     3    >   ASSIGN                                                   !2, 0
          4      > JMP                                                      ->9
    6     5    >   FETCH_DIM_W                                      $10     !0, !1
          6        ASSIGN_DIM                                               $10, !2
          7        OP_DATA                                                  !2
    5     8        PRE_INC                                                  !2
          9    >   IS_SMALLER                                               !2, 500
         10      > JMPNZ                                                    ~13, ->5
    4    11    >   PRE_INC                                                  !1
         12    >   IS_SMALLER                                               !1, 2000
         13      > JMPNZ                                                    ~15, ->3
    9    14    >   ASSIGN                                                   !3, <array>
   10    15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $17     
         18        ASSIGN                                                   !4, $17
   11    19      > FE_RESET_RW                                      $19     !0, ->23
         20    > > FE_FETCH_RW                                              $19, !5, ->23
   12    21    >   ASSIGN_OP                                     1          !3, !5
   11    22      > JMP                                                      ->20
         23    >   FE_FREE                                                  $19
   14    24        ASSIGN                                                   !3, <array>
   15    25      > FE_RESET_RW                                      $22     !0, ->29
         26    > > FE_FETCH_RW                                              $22, !5, ->29
   16    27    >   ASSIGN_OP                                     1          !3, !5
   15    28      > JMP                                                      ->26
         29    >   FE_FREE                                                  $22
   18    30        ASSIGN                                                   !3, <array>
   19    31      > FE_RESET_RW                                      $25     !0, ->35
         32    > > FE_FETCH_RW                                              $25, !5, ->35
   20    33    >   ASSIGN_OP                                     1          !3, !5
   19    34      > JMP                                                      ->32
         35    >   FE_FREE                                                  $25
   22    36        INIT_FCALL                                               'microtime'
         37        SEND_VAL                                                 <true>
         38        DO_ICALL                                         $27     
         39        ASSIGN                                                   !6, $27
   23    40        CONCAT                                           ~29     '%0AUnion+++++++time%3A+', !6
         41        ECHO                                                     ~29
   26    42        INIT_FCALL                                               'microtime'
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $30     
         45        ASSIGN                                                   !4, $30
   27    46        ASSIGN                                                   !3, <array>
   28    47        INIT_FCALL                                               'array_merge'
         48        SEND_UNPACK                                              !0
         49        CHECK_UNDEF_ARGS                                         
         50        DO_ICALL                                         $33     
         51        ASSIGN                                                   !3, $33
   29    52        ASSIGN                                                   !3, <array>
   30    53        INIT_FCALL                                               'array_merge'
         54        SEND_UNPACK                                              !0
         55        CHECK_UNDEF_ARGS                                         
         56        DO_ICALL                                         $36     
         57        ASSIGN                                                   !3, $36
   31    58        ASSIGN                                                   !3, <array>
   32    59        INIT_FCALL                                               'array_merge'
         60        SEND_UNPACK                                              !0
         61        CHECK_UNDEF_ARGS                                         
         62        DO_ICALL                                         $39     
         63        ASSIGN                                                   !3, $39
   33    64        INIT_FCALL                                               'microtime'
         65        SEND_VAL                                                 <true>
         66        DO_ICALL                                         $41     
         67        ASSIGN                                                   !6, $41
   34    68        CONCAT                                           ~43     '%0AArray+merge+time%3A+', !6
         69        ECHO                                                     ~43
   35    70      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.54 ms | 1008 KiB | 15 Q