I've been wrapping my head around this for days now, but nothing seems to give the desired result.
Example:
$var = "Some Words - Other Words (More Words) Dash-Binded-Word";
Desired result:
array(
[0] => Some Words
[1] => Other Words
[2] => More Words
[3] => Dash-Bound-Word
)
I was able to get this all working using preg_match_all, but then the "Dash-Bound-Word" was broken up as well. Trying to match it with surrounding spaces didn't work as it would break all the words except the dash bound ones.
The preg_match_all statement I used (which broke up the dash bound words too) is this:
preg_match_all('#\(.*?\)|\[.*?\]|[^?!\-|\(|\[]+#', $var, $array);
I'm certainly no expert on preg_match, preg_split so any help here would be greatly appreciated.
explode()? php.net/manual/en/function.explode.php ? - Maximus2012