Say I have the following array of associative arrays:
$MasterArr = array(
array("food" => "apple", "taste" => "sweet"),
array("food" => "lemon", "taste" => "sour"),
array("food" => "steak", "taste" => "meaty")
);
foreach
$FoodArr = array("apple","lemon","steak");
$TasteArr = array("sweet","sour","meaty");
You can use array_column
for that:
$FoodArr = array_column($MasterArr, 'food');
$TasteArr = array_column($MasterArr, 'taste');