3v4l.org

run code in 300+ PHP versions simultaneously
<?php function awesome(...$arrays) { if (!is_array($arrays)) return false; $merged = array_shift($arrays); foreach($arrays as $array) { foreach($array as $k => $v) { $merged[] = $v; } } return $merged; } $array1 = array('A' => 'Adam', 'B' => 'Bernie', 'C' => 'Chris'); $array2 = array('C' => 'Charlie', 'D' => 'David', 'E' => 'Earnslaw'); print_r($array1 + $array2); print_r(array_merge($array1, $array2)); print_r(awesome($array1, $array2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3RE2A
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array1, !1 = $array2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, <array>
   16     2        INIT_FCALL                                               'print_r'
          3        ADD                                              ~4      !0, !1
          4        SEND_VAL                                                 ~4
          5        DO_ICALL                                                 
   17     6        INIT_FCALL                                               'print_r'
          7        INIT_FCALL                                               'array_merge'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
   18    13        INIT_FCALL                                               'print_r'
         14        INIT_FCALL                                               'awesome'
         15        SEND_VAR                                                 !0
         16        SEND_VAR                                                 !1
         17        DO_FCALL                                      0  $8      
         18        SEND_VAR                                                 $8
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function awesome:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/3RE2A
function name:  awesome
number of ops:  22
compiled vars:  !0 = $arrays, !1 = $merged, !2 = $array, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_VARIADIC                                    !0      
    4     1        TYPE_CHECK                                  128  ~5      !0
          2        BOOL_NOT                                         ~6      ~5
          3      > JMPZ                                                     ~6, ->5
          4    > > RETURN                                                   <false>
    5     5    >   INIT_FCALL                                               'array_shift'
          6        SEND_REF                                                 !0
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !1, $7
    6     9      > FE_RESET_R                                       $9      !0, ->19
         10    > > FE_FETCH_R                                               $9, !2, ->19
    7    11    > > FE_RESET_R                                       $10     !2, ->17
         12    > > FE_FETCH_R                                       ~11     $10, !3, ->17
         13    >   ASSIGN                                                   !4, ~11
    8    14        ASSIGN_DIM                                               !1
         15        OP_DATA                                                  !3
    7    16      > JMP                                                      ->12
         17    >   FE_FREE                                                  $10
    6    18      > JMP                                                      ->10
         19    >   FE_FREE                                                  $9
   11    20      > RETURN                                                   !1
   12    21*     > RETURN                                                   null

End of function awesome

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.05 ms | 1394 KiB | 20 Q