Let\'s say i have this json data. How to transform the \"tags\" to a string like
$tags = \"Rihanna, We, Found, Love, (Explicit), Def, Jam, Records, Pop\";
Try:
foreach($videosList as $i=>$video){
$videosDatas['videos'][$i]['title'] = $video->title;
$tags = implode(', ',$video->tags);
$videosDatas['videos'][$i]['tags'] = $tags;
}
In place of your code:
for($i=0; $i<count($videosList); $i++) {
$videosDatas['videos'][$i]['title'] = $videosList[$i]['title'];
}
$comma_sep_string = implode(', ' , $videosDatas['videos'][$i]['tags']);
It looks like you need implode(). The function would be something like...
$tags = implode(', ', $videosDatas['videos'][$i]['tags']);