As already mentioned, you can just use explode to do this:
$str = 'word1 > word-2 > word.3 > word*4';
print_r(explode(" > " , $str));
However, for completeness, also use RegEx.
In this case, we can say that the regular expression groups all characters together that are not spaces and are not a separator >:
preg_match_all('/([^>\s]+)/', $str, $matches);
echo print_r($matches[0]);
source
share