I have a table that has a column with data stored as comma-separated strings.
I need to output the table contents and build an array from these values (don't need any keys).
I need to remove duplicates and sort it in alphabetical order.
$arr = array();
foreach ($myTable AS $t) {
$str = $t->myStr;
array_push($arr, $str);
}
array_unique($arr);
asort($arr);
I did print_r($arr); Now I see values but they are still an array of strings. Something like this:
Array ( [1] => Chinese, Asian Fusion, Food Trucks [0] => Chinese, Asian Fusion, Gluten-Free [2] => Chinese, Barbeque [3] => Dim Sum, Seafood, Soup )
What I would like to see is:
Array ('Asian Fusion', 'Barbeque', 'Chinese', 'Food Trucks', 'Gluten-Free'...);
array_unique()should be reassigned to$arrprint_r($arr);