3v4l.org

run code in 300+ PHP versions simultaneously
<?php function append(array $init, array $add, $key = null) { $_init = $init; if (is_null($key)) $_init[] = $add; else $_init[$key] = $add; var_dump($init, $_init); return array_merge($_init, $init); } $a = [ 'phone' => [ 'code' => '+38', ], ]; $b = [ 'prefix' => '095', 'number' => '7700418', ]; var_dump(append($a, $b, 'phone'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kXQLf
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   22     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'append'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 'phone'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function append:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kXQLf
function name:  append
number of ops:  21
compiled vars:  !0 = $init, !1 = $add, !2 = $key, !3 = $_init
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
    4     3        ASSIGN                                                   !3, !0
    5     4        TYPE_CHECK                                    2          !2
          5      > JMPZ                                                     ~5, ->9
    6     6    >   ASSIGN_DIM                                               !3
          7        OP_DATA                                                  !1
          8      > JMP                                                      ->11
    8     9    >   ASSIGN_DIM                                               !3, !2
         10        OP_DATA                                                  !1
    9    11    >   INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                                 
   10    15        INIT_FCALL                                               'array_merge'
         16        SEND_VAR                                                 !3
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $9      
         19      > RETURN                                                   $9
   11    20*     > RETURN                                                   null

End of function append

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.79 ms | 1398 KiB | 18 Q