3v4l.org

run code in 300+ PHP versions simultaneously
<?php $prefixes = array( 'aaa' => true, 'bbb' => true, 'ccc' => true, 'ddd' => true, ); $array = array(); for ($i = 0; $i < 50; $i++) { $values = array(); for ($j = 0; $j < 5000; $j++) { $values[array_rand($prefixes).$j] = mt_rand(0, 1000); } $array[$i] = $values; } $t = microtime(1); $result1 = array(); foreach ($array as $v) { $result1 = array_merge($result1, $v); } echo 'multiple: '.(microtime(1) - $t)."\n"; $t = microtime(1); $result2 = call_user_func_array('array_merge', $array); echo 'single: '.(microtime(1) - $t)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 4
Branch analysis from position: 25
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 38
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 38
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 7
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 4
Branch analysis from position: 25
Branch analysis from position: 4
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 7
Branch analysis from position: 20
Branch analysis from position: 7
filename:       /in/kJmVl
function name:  (null)
number of ops:  63
compiled vars:  !0 = $prefixes, !1 = $array, !2 = $i, !3 = $values, !4 = $j, !5 = $t, !6 = $result1, !7 = $v, !8 = $result2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   12     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->23
   13     4    >   ASSIGN                                                   !3, <array>
   14     5        ASSIGN                                                   !4, 0
          6      > JMP                                                      ->18
   15     7    >   INIT_FCALL                                               'array_rand'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $14     
         10        CONCAT                                           ~15     $14, !4
         11        INIT_FCALL                                               'mt_rand'
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 1000
         14        DO_ICALL                                         $17     
         15        ASSIGN_DIM                                               !3, ~15
         16        OP_DATA                                                  $17
   14    17        PRE_INC                                                  !4
         18    >   IS_SMALLER                                               !4, 5000
         19      > JMPNZ                                                    ~19, ->7
   18    20    >   ASSIGN_DIM                                               !1, !2
         21        OP_DATA                                                  !3
   12    22        PRE_INC                                                  !2
         23    >   IS_SMALLER                                               !2, 50
         24      > JMPNZ                                                    ~22, ->4
   21    25    >   INIT_FCALL                                               'microtime'
         26        SEND_VAL                                                 1
         27        DO_ICALL                                         $23     
         28        ASSIGN                                                   !5, $23
   23    29        ASSIGN                                                   !6, <array>
   24    30      > FE_RESET_R                                       $26     !1, ->38
         31    > > FE_FETCH_R                                               $26, !7, ->38
   25    32    >   INIT_FCALL                                               'array_merge'
         33        SEND_VAR                                                 !6
         34        SEND_VAR                                                 !7
         35        DO_ICALL                                         $27     
         36        ASSIGN                                                   !6, $27
   24    37      > JMP                                                      ->31
         38    >   FE_FREE                                                  $26
   28    39        INIT_FCALL                                               'microtime'
         40        SEND_VAL                                                 1
         41        DO_ICALL                                         $29     
         42        SUB                                              ~30     $29, !5
         43        CONCAT                                           ~31     'multiple%3A+', ~30
         44        CONCAT                                           ~32     ~31, '%0A'
         45        ECHO                                                     ~32
   29    46        INIT_FCALL                                               'microtime'
         47        SEND_VAL                                                 1
         48        DO_ICALL                                         $33     
         49        ASSIGN                                                   !5, $33
   31    50        INIT_FCALL                                               'array_merge'
         51        SEND_ARRAY                                               !1
         52        CHECK_UNDEF_ARGS                                         
         53        DO_FCALL                                      1  $35     
         54        ASSIGN                                                   !8, $35
   33    55        INIT_FCALL                                               'microtime'
         56        SEND_VAL                                                 1
         57        DO_ICALL                                         $37     
         58        SUB                                              ~38     $37, !5
         59        CONCAT                                           ~39     'single%3A+', ~38
         60        CONCAT                                           ~40     ~39, '%0A'
         61        ECHO                                                     ~40
         62      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.74 ms | 1006 KiB | 17 Q