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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.61 ms | 1008 KiB | 15 Q