Here, I have two multi-dimensional array. As I want to find the value from first array if the value is there in second array or not.
First array:
$abc = array(
array("fld_channel_selected_item_track_id" => 627905217),
array("fld_channel_selected_item_track_id" => 616557954)
);
Second array:
$pqr = array(
array(
"fld_channel_item_track" => 627905217,
"fld_channel_item_title" => "Tropical Fantasy"
),
array(
"fld_channel_item_track" => 616557954,
"fld_channel_item_title" => "Bday Boys"
)
);
So, I am searching if the first array value is there in second array value or not:
for($i = 0;$i < count($abc); $i++)
{
$pos = array_search($abc[$i]["fld_channel_selected_item_track_id"], array_column($pqr, 'fld_channel_item_track'));
if($pos)
{
echo "<pre>";print_r($pqr[$pos]);
}
}
exit;
The outout is:
<pre>Array
(
[fld_channel_item_track] => 616557954
[fld_channel_item_title] => Bday Boys
)
Here, I am not getting the first value in my output.
Where I am wrong in that?