Convert comma separated string into array

前端 未结 10 1574
南笙
南笙 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:29

    Why not put all tags in an array when you are creating them, and later explode the array and add the commas and spaces between the tags.

    foreach ( $tags_arr as $tag ) {
        $tags = '' . $tag . '';
        $tagss[] = $tags;
    }
    $tagss = explode(', ', $tagss);
    

提交回复
热议问题