3v4l.org

run code in 300+ 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);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 1 [1] => 2 )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
26.54 ms | 405 KiB | 5 Q