The string I am trying to split is $item[\'category_names\']
which for example contains Hair, Fashion, News
I currently have the following
if you use this:
$cats = explode(", ", $item['category_names']);
foreach($cats as $cat) {
$categories = "" . $cat . " \n";
}
the $categories string is overwritten each time, so "hair" and "fasion" are lost..
if you however add a dot before the equal sign in the for loop, like so:
$cats = explode(", ", $item['category_names']);
foreach($cats as $cat) {
$categories .= "" . $cat . " \n";
}
the $catergories string will consist of all three values :)