3v4l.org

run code in 300+ PHP versions simultaneously
<?php function merge(array $a, array $b) { foreach ($b as $key => $value) { if (isset($key, $a)) { 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; } $a = array('person' => array( 'name' => 'franz', 'last_name' => 'de leon', )); $b = array('person' => array( 'name' => 'cheryl', )); var_dump(merge($a, $b));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PGJWi
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ASSIGN                                                   !0, <array>
   27     1        ASSIGN                                                   !1, <array>
   32     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'merge'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

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

End of function merge

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.25 ms | 1403 KiB | 16 Q