3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); $b = array('stupid' => array('franz', 'de leon')); $c = array_merge($a, $b); var_dump($c); abstract class Utility { public static 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) && (isset($a[$key]) && is_array($a[$key]))) { $a[$key] = static::merge($a[$key], $value); } else { $a[$key] = $value; } } else { $a[$key] = $value; } } return $a; } } $d = Utility::merge($a, $b); var_dump($d);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L01vX
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_merge'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
    7     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
   30    10        INIT_STATIC_METHOD_CALL                                  'Utility', 'merge'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        DO_FCALL                                      0  $9      
         14        ASSIGN                                                   !3, $9
   31    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

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

End of function merge

End of class Utility.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.61 ms | 1400 KiB | 17 Q