I scroll through my array to print article names:
<?php if ($articles) { foreach($articles as $article) { echo $article->name.", "; }
This will obviously lead to something like
Apple, Banana, Mango,
But I am looking for:
Apple, Banana, Mango
I tried several implode statements as follows:
<?php if ($articles) { foreach($articles as $article) { echo implode(", ", $article->name); }
or
<?php if ($articles) { echo implode(", ", $articles->article->name); }
None of them work for me. How can this be done correctly? Thanks for the tips!
source share