如果您的示例字符串是典型的,请从处理单引号和双引号开始。我在这里使用了heredoc 语法来使字符串可以安全使用。
$string = <<<TEST
Hello World, "Japan and China", Americans, Asians, "Jews and Christians", and semi-catholics, Jehovah's witnesses
TEST;
$safe_string = addslashes($string);//make the string safe to work with
$pieces = explode(",",$safe_string);//break into pieces on comma
$words_and_phrases = array();//initiate new array
foreach($pieces as $piece)://begin working with the pieces
$piece = trim($piece);//a little clean up
if(strpos($piece,'"'))://this is a phrase
$words_and_phrases[] = str_replace('"','',stripslashes($piece));
else://else, these are words
$words = explode(" ",stripslashes($piece));
$words_and_phrases = array_merge($words_and_phrases, $words);
endif;
endforeach;
print_r($words_and_phrases);
注意:您也可以使用 preg_replace,但对于这样的事情似乎有点过分了。