3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('a' => 'a', 'b' => 'b', 'z' => array('c' => 'c', 'd' => 'd')); $b = array('a' => 'c', 'z' => array('c' => 'e')); $merge = function(&$a, &$b) use (&$merge){ if (is_array($a) && is_array($b)){ foreach ($b as $key => &$value){ if (is_array($value) && isset($a[$key]) && is_array($a[$key])){ $a[$key] = $merge($a[$key], $value); } else { if (is_int($key)){ $a[] = $value; } else { $a[$key] = $value; } } } return $a; } else { return $b; } }; var_dump($merge($a, $b));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0PpmZ
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b, !2 = $merge
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    5     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F0PpmZ%3A5%240'
          3        BIND_LEXICAL                                             ~5, !2
          4        ASSIGN                                                   !2, ~5
   24     5        INIT_FCALL                                               'var_dump'
          6        INIT_DYNAMIC_CALL                                        !2
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $7      
         10        SEND_VAR                                                 $7
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F0PpmZ%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 40
Branch analysis from position: 8
2 jumps found. (Code = 125) Position 1 = 9, Position 2 = 37
Branch analysis from position: 9
2 jumps found. (Code = 126) Position 1 = 10, Position 2 = 37
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 29
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 34
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 19
Branch analysis from position: 15
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/0PpmZ
function name:  {closure}
number of ops:  42
compiled vars:  !0 = $a, !1 = $b, !2 = $merge, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    6     3        TYPE_CHECK                                  128  ~5      !0
          4      > JMPZ_EX                                          ~5      ~5, ->7
          5    >   TYPE_CHECK                                  128  ~6      !1
          6        BOOL                                             ~5      ~6
          7    > > JMPZ                                                     ~5, ->40
    7     8    > > FE_RESET_RW                                      $7      !1, ->37
          9    > > FE_FETCH_RW                                      ~8      $7, !3, ->37
         10    >   ASSIGN                                                   !4, ~8
    8    11        TYPE_CHECK                                  128  ~10     !3
         12      > JMPZ_EX                                          ~10     ~10, ->15
         13    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~11     !0, !4
         14        BOOL                                             ~10     ~11
         15    > > JMPZ_EX                                          ~10     ~10, ->19
         16    >   FETCH_DIM_R                                      ~12     !0, !4
         17        TYPE_CHECK                                  128  ~13     ~12
         18        BOOL                                             ~10     ~13
         19    > > JMPZ                                                     ~10, ->29
    9    20    >   INIT_DYNAMIC_CALL                                        !2
         21        CHECK_FUNC_ARG                                           
         22        FETCH_DIM_FUNC_ARG                               $15     !0, !4
         23        SEND_FUNC_ARG                                            $15
         24        SEND_VAR_EX                                              !3
         25        DO_FCALL                                      0  $16     
         26        ASSIGN_DIM                                               !0, !4
         27        OP_DATA                                                  $16
         28      > JMP                                                      ->36
   11    29    >   TYPE_CHECK                                   16          !4
         30      > JMPZ                                                     ~17, ->34
   12    31    >   ASSIGN_DIM                                               !0
         32        OP_DATA                                                  !3
         33      > JMP                                                      ->36
   14    34    >   ASSIGN_DIM                                               !0, !4
         35        OP_DATA                                                  !3
    7    36    > > JMP                                                      ->9
         37    >   FE_FREE                                                  $7
   18    38      > RETURN                                                   !0
         39*       JMP                                                      ->41
   20    40    > > RETURN                                                   !1
   22    41*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F0PpmZ%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.92 ms | 1400 KiB | 15 Q