I have a string as below
$str = '"Mark Zuckerberg" facebook "A social utility connecting friends" profile';
I want it to be manipulated as follows
$output = '"Mark Zuckerberg" OR facebook OR "A social utility connecting friends" OR profile';
What I am trying to have in output is all the units combined with OR in between them. Here a unit is wither a single word when its not in double quotes or the complete string that falls within the single quotes.
I wanted to try with preg_replace. But am unable to get a correct regular expression to match. Kindly help!