$arr = [
["name" => "Austin"],
["name" => "Nashville"],
["name" => "Foldo"],
["name" => "Femosss"];
function sorting($arr){
if($_GET['filter'] == 'A'){
/// code
}
if($_GET['filter'] == 'F'){
/// code
}
return return ['A', 'F'];
}
]
$arr = [
["name" => "Austin"],
["name" => "Nashville"],
["name" => "Foldo"],
["name" => "Femosss"]
];
function arrayFilterFirstChar(array $arr, string $chr): array
{
return array_values(array_filter($arr, fn($val) => $val['name'][0] == $chr));
}
var_dump(arrayFilterFirstChar($arr, 'F'));