Ive got an array of Wordpress-Categories. What I want, is to output their names, seperated with a comma. - like this:
category1, category2, category3, category4, category5, ...
I tried this foreach loop:
foreach ($category as $cat){
$catList = $cat->name.', ';
echo $catList ;
}
But the output looks like this: category1, category2, category3,
As you can see, there is a comma at the end, which I dont want.
How would this work?