3v4l.org

run code in 300+ PHP versions simultaneously
<?php $muLevelIds = [1,6,7,8,9]; $subjectLevelIds = [1,6,7,8]; $occLevelIds = []; var_dump(array_union($muLevelIds, $subjectLevelIds, $occLevelIds)); function array_union($muLevelIds, $subjectLevelIds, $occLevelIds) { $allLevelIds = [1,6,7,8,9]; $arrays = [$muLevelIds, $subjectLevelIds, $occLevelIds]; $comp = [$allLevelIds]; foreach ($arrays as $arr) { if (count($arr)) { $comp[] = $arr; } } $combined = call_user_func_array('array_intersect', $comp); return $combined; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LvV7H
function name:  (null)
number of ops:  12
compiled vars:  !0 = $muLevelIds, !1 = $subjectLevelIds, !2 = $occLevelIds
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    7     1        ASSIGN                                                   !1, <array>
    9     2        ASSIGN                                                   !2, <array>
   11     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL_BY_NAME                                       'array_union'
          5        SEND_VAR_EX                                              !0
          6        SEND_VAR_EX                                              !1
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0  $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                                 
   30    11      > RETURN                                                   1

Function array_union:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 16
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/LvV7H
function name:  array_union
number of ops:  25
compiled vars:  !0 = $muLevelIds, !1 = $subjectLevelIds, !2 = $occLevelIds, !3 = $allLevelIds, !4 = $arrays, !5 = $comp, !6 = $arr, !7 = $combined
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   16     3        ASSIGN                                                   !3, <array>
   18     4        INIT_ARRAY                                       ~9      !0
          5        ADD_ARRAY_ELEMENT                                ~9      !1
          6        ADD_ARRAY_ELEMENT                                ~9      !2
          7        ASSIGN                                                   !4, ~9
   19     8        INIT_ARRAY                                       ~11     !3
          9        ASSIGN                                                   !5, ~11
   20    10      > FE_RESET_R                                       $13     !4, ->17
         11    > > FE_FETCH_R                                               $13, !6, ->17
   21    12    >   COUNT                                            ~14     !6
         13      > JMPZ                                                     ~14, ->16
   22    14    >   ASSIGN_DIM                                               !5
         15        OP_DATA                                                  !6
   20    16    > > JMP                                                      ->11
         17    >   FE_FREE                                                  $13
   25    18        INIT_FCALL                                               'array_intersect'
         19        SEND_ARRAY                                               !5
         20        CHECK_UNDEF_ARGS                                         
         21        DO_FCALL                                      0  $16     
         22        ASSIGN                                                   !7, $16
   27    23      > RETURN                                                   !7
   30    24*     > RETURN                                                   null

End of function array_union

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.33 ms | 1400 KiB | 17 Q