Search code examples
phptags

php paragraph convert to tags separate words


I have paragraph or words like: $title = "stack over flow is good site"

I want it in tags like : stack, over, flow , is, good, site

<? echo strtolower( $title); ?>

In php which function i use?


Solution

  • This line should work for you.

    <? echo strtolower(str_replace(" ", ",", $title)); ?>
    

    Or you can try

    <? echo implode(', ', explode(" ", strtolower($title))); ?>