I am adding the names of regions to a a variable using the below code (shortened). Everything works as intended, except for the sort function which throws an error saying that it requires an array instead of a string.
How can I still manage to sort the content of my variable alphabetically ?
$regions = '';
$countR = 1;
foreach ($objR->days as $days) {
if($days->dateMatch == "Yes" && !empty($days->regions)) {
foreach(explode(',', $days->regions) as $r){
$regions .= str_replace(" / ", ", ", $r)) . "<br />";
$countR++;
}
}
}
sort($regions);