3v4l.org

run code in 300+ PHP versions simultaneously
<?php function iMerge($one, $two) { $keys = array_combine(array_keys(array_change_key_case($one, CASE_LOWER)), array_keys($one)); foreach ($two as $k => $v) { if (is_int($k)) { $one[] = $v; } elseif (array_key_exists($lower = strtolower($k), $keys)) { $one[$keys[$lower]] = $v; } else { $one[$k] = $v; } } return $one; } $one = array(0, 'a' => 'aaa', 'b' => 'bbb', 1); $two = array(2, 'A' => 'AAA', 'C' => 'CCC', 3); print_r(iMerge($one, $two));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H3KEt
function name:  (null)
number of ops:  10
compiled vars:  !0 = $one, !1 = $two
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   19     1        ASSIGN                                                   !1, <array>
   21     2        INIT_FCALL                                               'print_r'
          3        INIT_FCALL                                               'imerge'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function imerge:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 38
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 38
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 35
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/H3KEt
function name:  iMerge
number of ops:  41
compiled vars:  !0 = $one, !1 = $two, !2 = $keys, !3 = $v, !4 = $k, !5 = $lower
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'array_combine'
          3        INIT_FCALL                                               'array_keys'
          4        INIT_FCALL                                               'array_change_key_case'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 0
          7        DO_ICALL                                         $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                         $7      
         10        SEND_VAR                                                 $7
         11        INIT_FCALL                                               'array_keys'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                         $9      
         16        ASSIGN                                                   !2, $9
    5    17      > FE_RESET_R                                       $11     !1, ->38
         18    > > FE_FETCH_R                                       ~12     $11, !3, ->38
         19    >   ASSIGN                                                   !4, ~12
    6    20        TYPE_CHECK                                   16          !4
         21      > JMPZ                                                     ~14, ->25
    7    22    >   ASSIGN_DIM                                               !0
         23        OP_DATA                                                  !3
         24      > JMP                                                      ->37
    8    25    >   INIT_FCALL                                               'strtolower'
         26        SEND_VAR                                                 !4
         27        DO_ICALL                                         $16     
         28        ASSIGN                                           ~17     !5, $16
         29        ARRAY_KEY_EXISTS                                         ~17, !2
         30      > JMPZ                                                     ~18, ->35
    9    31    >   FETCH_DIM_R                                      ~19     !2, !5
         32        ASSIGN_DIM                                               !0, ~19
         33        OP_DATA                                                  !3
         34      > JMP                                                      ->37
   11    35    >   ASSIGN_DIM                                               !0, !4
         36        OP_DATA                                                  !3
    5    37    > > JMP                                                      ->18
         38    >   FE_FREE                                                  $11
   15    39      > RETURN                                                   !0
   16    40*     > RETURN                                                   null

End of function imerge

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.53 ms | 1402 KiB | 24 Q