Convert comma separated string into array

前端 未结 10 1566
南笙
南笙 2020-12-17 20:08

I have a comma separated string, which consists of a list of tags and want to convert it to array to get a link for every tag.

Example:

$string = \'h         


        
10条回答
  •  既然无缘
    2020-12-17 20:50

    Just like you exploded you can implode again:

    $tags = explode(',', $arg);
    foreach ($tags as &$tag) {
        $tag = '' . $tag . '';
    }
    
    return implode(', ', $tags);
    

提交回复
热议问题