关键字搜索[重复]

Possible Duplicate:
How can I split a list with multiple delimiters?

I am a newbie in php and My client want me to search utility in php webapplication using which user can enter words having spaces or commas. I am not sure is this possible in php to seaparate a string based on commas and spaces as well. As explode converts the string in array which can not be again used with explode..

For more complex string splitting, use preg_split() or mb_split() and supply a regular expression.

Use mb_split() if your input string is in a multibyte encoding and you need to match against those characters for your split expression.

Example:

$input = "a,b, c d";
$psplit = preg_split('/[\s,]+/', $input);
$mbsplit = mb_split('[\s,]+', $input);
$psplit===$mbsplit; // === array('a','b','c','d');