help with explode()

From: Date: Fri, 24 Apr 2009 15:41:06 +0000
Subject: help with explode()
Groups: php.general 
Request: Send a blank email to php-general+get-291943@lists.php.net to get a copy of this message
I have a form where users submit search terms and it explodes the terms into an array based upon spaces. But, how can I have explode() keep words in quotation marks together? For example, if someone enters on the form: John Jill "Judy Smith" and I run $termsarray = explode(" ", $_POST["terms"]); it explodes into: Array ( [0] => John [1] => Jill [2] => "Judy [3] => Smith" ) but I'd like it to explode into: Array ( [0] => John [1] => Jill [2] => "Judy Smith" )

« previous php.general (#291943) next »