3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('foo' => "xyz", null => "abc"); $b = array('bar' => "baz", null => "xyz"); var_dump(array_merge_recursive($a,$b)); var_dump(merge($a,$b)); function merge(array $a, array $b) { foreach ($b as $key => $value) { if (isset($a[$key])) { if (is_int($key)) { $a[] = $value; } elseif (is_array($value) && is_array($a[$key])) { $a[$key] = merge($a[$key], $value); } else { $a[$key] = $value; } } else { $a[$key] = $value; } } return $a; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jj34G
function name:  (null)
number of ops:  17
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    7     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'array_merge_recursive'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
    8     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL_BY_NAME                                       'merge'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
   28    16      > RETURN                                                   1

Function merge:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 33
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 33
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 30
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 27
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 17
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/Jj34G
function name:  merge
number of ops:  36
compiled vars:  !0 = $a, !1 = $b, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2      > FE_RESET_R                                       $4      !1, ->33
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->33
          4    >   ASSIGN                                                   !3, ~5
   14     5        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !3
          6      > JMPZ                                                     ~7, ->30
   15     7    >   TYPE_CHECK                                   16          !3
          8      > JMPZ                                                     ~8, ->12
   16     9    >   ASSIGN_DIM                                               !0
         10        OP_DATA                                                  !2
         11      > JMP                                                      ->29
   17    12    >   TYPE_CHECK                                  128  ~10     !2
         13      > JMPZ_EX                                          ~10     ~10, ->17
         14    >   FETCH_DIM_R                                      ~11     !0, !3
         15        TYPE_CHECK                                  128  ~12     ~11
         16        BOOL                                             ~10     ~12
         17    > > JMPZ                                                     ~10, ->27
   18    18    >   INIT_FCALL_BY_NAME                                       'merge'
         19        CHECK_FUNC_ARG                                           
         20        FETCH_DIM_FUNC_ARG                               $14     !0, !3
         21        SEND_FUNC_ARG                                            $14
         22        SEND_VAR_EX                                              !2
         23        DO_FCALL                                      0  $15     
         24        ASSIGN_DIM                                               !0, !3
         25        OP_DATA                                                  $15
         26      > JMP                                                      ->29
   20    27    >   ASSIGN_DIM                                               !0, !3
         28        OP_DATA                                                  !2
         29    > > JMP                                                      ->32
   23    30    >   ASSIGN_DIM                                               !0, !3
         31        OP_DATA                                                  !2
   13    32    > > JMP                                                      ->3
         33    >   FE_FREE                                                  $4
   27    34      > RETURN                                                   !0
   28    35*     > RETURN                                                   null

End of function merge

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.6 ms | 1392 KiB | 17 Q