3v4l.org

run code in 300+ PHP versions simultaneously
<?php $wtf = array(); $a = parse_str("elements[55][e_id]=1", $tmp_save1); $wtf = array_merge_recursive_new($wtf, $tmp_save1); $b = parse_str("elements[55][wtf]=2", $tmp_save2); $wtf = array_merge_recursive_new($wtf, $tmp_save2); print_r($wtf); function array_merge_recursive_new() { $arrays = func_get_args(); $base = array_shift($arrays); foreach ($arrays as $array) { reset($base); //important while (list($key, $value) = @each($array)) { if (is_array($value) && @is_array($base[$key])) { $base[$key] = array_merge_recursive_new($base[$key], $value); } else { $base[$key] = $value; } } } return $base; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gF25B
function name:  (null)
number of ops:  25
compiled vars:  !0 = $wtf, !1 = $a, !2 = $tmp_save1, !3 = $b, !4 = $tmp_save2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'parse_str'
          2        SEND_VAL                                                 'elements%5B55%5D%5Be_id%5D%3D1'
          3        SEND_REF                                                 !2
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
    6     6        INIT_FCALL_BY_NAME                                       'array_merge_recursive_new'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !0, $8
    8    11        INIT_FCALL                                               'parse_str'
         12        SEND_VAL                                                 'elements%5B55%5D%5Bwtf%5D%3D2'
         13        SEND_REF                                                 !4
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !3, $10
    9    16        INIT_FCALL_BY_NAME                                       'array_merge_recursive_new'
         17        SEND_VAR_EX                                              !0
         18        SEND_VAR_EX                                              !4
         19        DO_FCALL                                      0  $12     
         20        ASSIGN                                                   !0, $12
   11    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
   29    24      > RETURN                                                   1

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

End of function array_merge_recursive_new

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.27 ms | 1400 KiB | 21 Q