<?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);
You have javascript disabled. You will not be able to edit any code.