if the user enters tag:love,life,success
then i use
Code: Select all
$wordlist=explode(",",$tags);Now if the user writes tags: love ,life , success then the regex allows spaces and commas in addition to alphanumeric data.
Is there any way/solution such that i can explode (split a string) with delimiter comma OR space instead of just a comma as in
Code: Select all
$wordlist=explode(",",$tags);"," delimits using only a comma
Code: Select all
$wordlist=explode(" ",$tags);" " delimits using only a space
If there is space then also the array should be split. If there is a comma then also the array should split. And if there is a combination or comma space then too array should be split
Is there anyway i can check what is the delimiter either , or space or both and accordingly i can proceed?