3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_push_cust(&$arr, ...$args) { foreach ($args as $k => $v) { if (is_int($k)) { $arr[] = $v; } else { $arr[$k] = $v; } } } $arr = [1, 'a' => 2]; $arr2 = [3, 'b' => 4]; $res = $arr; array_push_cust($res, ...$arr2); print_r($res); $res = $arr; array_push($res, ...$arr2); print_r($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0p5Sv
function name:  (null)
number of ops:  21
compiled vars:  !0 = $arr, !1 = $arr2, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   16     2        ASSIGN                                                   !2, !0
   17     3        INIT_FCALL                                               'array_push_cust'
          4        SEND_REF                                                 !2
          5        SEND_UNPACK                                              !1
          6        CHECK_UNDEF_ARGS                                         
          7        DO_FCALL                                      1          
   18     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                                 
   20    11        ASSIGN                                                   !2, !0
   21    12        INIT_FCALL                                               'array_push'
         13        SEND_REF                                                 !2
         14        SEND_UNPACK                                              !1
         15        CHECK_UNDEF_ARGS                                         
         16        DO_ICALL                                                 
   22    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function array_push_cust:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/0p5Sv
function name:  array_push_cust
number of ops:  15
compiled vars:  !0 = $arr, !1 = $args, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_VARIADIC                                    !1      
    4     2      > FE_RESET_R                                       $4      !1, ->13
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->13
          4    >   ASSIGN                                                   !3, ~5
    5     5        TYPE_CHECK                                   16          !3
          6      > JMPZ                                                     ~7, ->10
    6     7    >   ASSIGN_DIM                                               !0
          8        OP_DATA                                                  !2
    5     9      > JMP                                                      ->12
    8    10    >   ASSIGN_DIM                                               !0, !3
         11        OP_DATA                                                  !2
    4    12    > > JMP                                                      ->3
         13    >   FE_FREE                                                  $4
   11    14      > RETURN                                                   null

End of function array_push_cust

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.25 ms | 1006 KiB | 16 Q