3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $muLevelIds = []; $subjectLevelIds = [1,6,7,8]; $occLevelIds = [6,7]; var_dump(array_union($muLevelIds, $subjectLevelIds, $occLevelIds)); function array_union($muLevelIds, $subjectLevelIds, $occLevelIds) { $allLevelIds = [1,6,7,8,9]; $combined = array_intersect($allLevelIds, $muLevelIds, $subjectLevelIds, $occLevelIds); return array_intersect($allLevelIds, $combined); }
based on ZqSoY
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/sdX8g
function name:  (null)
number of ops:  13
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                                                 
  14    11        NOP                                                      
  23    12      > RETURN                                                   1

Function array_union:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/sdX8g
function name:  array_union
number of ops:  17
compiled vars:  !0 = $muLevelIds, !1 = $subjectLevelIds, !2 = $occLevelIds, !3 = $allLevelIds, !4 = $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_FCALL                                               'array_intersect'
         5        SEND_VAR                                                 !3
         6        SEND_VAR                                                 !0
         7        SEND_VAR                                                 !1
         8        SEND_VAR                                                 !2
         9        DO_ICALL                                         $6      
        10        ASSIGN                                                   !4, $6
  20    11        INIT_FCALL                                               'array_intersect'
        12        SEND_VAR                                                 !3
        13        SEND_VAR                                                 !4
        14        DO_ICALL                                         $8      
        15      > RETURN                                                   $8
  23    16*     > RETURN                                                   null

End of function array_union

Generated using Vulcan Logic Dumper, using php 7.3.0