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; } echo PHP_EOL . 'Union time: ' . microtime(true); $start = microtime(true); $mergedArray = []; $mergedArray = array_merge(...$all); $mergedArray = []; $mergedArray = array_merge(...$all); $mergedArray = []; $mergedArray = array_merge(...$all); echo PHP_EOL . 'Array merge time: ' . microtime(true);
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/n9P5j
function name:  (null)
number of ops:  69
compiled vars:  !0 = $all, !1 = $i, !2 = $j, !3 = $mergedArray, !4 = $start, !5 = $templateClosingArray
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                                      $9      !0, !1
          6        ASSIGN_DIM                                               $9, !2
          7        OP_DATA                                                  !2
    5     8        PRE_INC                                                  !2
          9    >   IS_SMALLER                                               !2, 500
         10      > JMPNZ                                                    ~12, ->5
    4    11    >   PRE_INC                                                  !1
         12    >   IS_SMALLER                                               !1, 2000
         13      > JMPNZ                                                    ~14, ->3
    9    14    >   ASSIGN                                                   !3, <array>
   10    15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $16     
         18        ASSIGN                                                   !4, $16
   11    19      > FE_RESET_RW                                      $18     !0, ->23
         20    > > FE_FETCH_RW                                              $18, !5, ->23
   12    21    >   ASSIGN_OP                                     1          !3, !5
   11    22      > JMP                                                      ->20
         23    >   FE_FREE                                                  $18
   14    24        ASSIGN                                                   !3, <array>
   15    25      > FE_RESET_RW                                      $21     !0, ->29
         26    > > FE_FETCH_RW                                              $21, !5, ->29
   16    27    >   ASSIGN_OP                                     1          !3, !5
   15    28      > JMP                                                      ->26
         29    >   FE_FREE                                                  $21
   18    30        ASSIGN                                                   !3, <array>
   19    31      > FE_RESET_RW                                      $24     !0, ->35
         32    > > FE_FETCH_RW                                              $24, !5, ->35
   20    33    >   ASSIGN_OP                                     1          !3, !5
   19    34      > JMP                                                      ->32
         35    >   FE_FREE                                                  $24
   22    36        INIT_FCALL                                               'microtime'
         37        SEND_VAL                                                 <true>
         38        DO_ICALL                                         $26     
         39        CONCAT                                           ~27     '%0AUnion+++++++time%3A+', $26
         40        ECHO                                                     ~27
   25    41        INIT_FCALL                                               'microtime'
         42        SEND_VAL                                                 <true>
         43        DO_ICALL                                         $28     
         44        ASSIGN                                                   !4, $28
   26    45        ASSIGN                                                   !3, <array>
   27    46        INIT_FCALL                                               'array_merge'
         47        SEND_UNPACK                                              !0
         48        CHECK_UNDEF_ARGS                                         
         49        DO_ICALL                                         $31     
         50        ASSIGN                                                   !3, $31
   28    51        ASSIGN                                                   !3, <array>
   29    52        INIT_FCALL                                               'array_merge'
         53        SEND_UNPACK                                              !0
         54        CHECK_UNDEF_ARGS                                         
         55        DO_ICALL                                         $34     
         56        ASSIGN                                                   !3, $34
   30    57        ASSIGN                                                   !3, <array>
   31    58        INIT_FCALL                                               'array_merge'
         59        SEND_UNPACK                                              !0
         60        CHECK_UNDEF_ARGS                                         
         61        DO_ICALL                                         $37     
         62        ASSIGN                                                   !3, $37
   32    63        INIT_FCALL                                               'microtime'
         64        SEND_VAL                                                 <true>
         65        DO_ICALL                                         $39     
         66        CONCAT                                           ~40     '%0AArray+merge+time%3A+', $39
         67        ECHO                                                     ~40
         68      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.18 ms | 1008 KiB | 15 Q