3v4l.org

run code in 500+ PHP versions simultaneously
<?php $item = [1,2,11, 4]; $products = [["id" => 1, "name" => "abc"], ["id" => 2, "name"=> "xyz"]]; // Get the ids of all products as an indexed array $prodIds = array_column($products, 'id'); // Check the id's that exists in both $existingIds = array_intersect($item, $prodIds); print_r($existingIds);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HJSoq
function name:  (null)
number of ops:  16
compiled vars:  !0 = $item, !1 = $products, !2 = $prodIds, !3 = $existingIds
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    7     2        INIT_FCALL                                                   'array_column'
          3        SEND_VAR                                                     !1
          4        SEND_VAL                                                     'id'
          5        DO_ICALL                                             $6      
          6        ASSIGN                                                       !2, $6
   10     7        INIT_FCALL                                                   'array_intersect'
          8        SEND_VAR                                                     !0
          9        SEND_VAR                                                     !2
         10        DO_ICALL                                             $8      
         11        ASSIGN                                                       !3, $8
   12    12        INIT_FCALL                                                   'print_r'
         13        SEND_VAR                                                     !3
         14        DO_ICALL                                                     
         15      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.07 ms | 1855 KiB | 16 Q