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; return array_merge($_init, $init); } $a = [ 'body' => [ 'code' => '+38095', ], ]; $b = [ 'my_test' => [ 1, 4, 9, 92 ], ]; var_dump(append($a, $b, 'body'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mnjrp
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, <array>
   25     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'append'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 'body'
          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/Mnjrp
function name:  append
number of ops:  17
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                                               'array_merge'
         12        SEND_VAR                                                 !3
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
         15      > RETURN                                                   $8
   10    16*     > RETURN                                                   null

End of function append

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.76 ms | 1399 KiB | 18 Q