I want to put a + in front of each word in a string, except when the word begins with a *.
Here's what I do to put the + in front of each word :
$string = " *these are my words ";
$trimmed = trim($string);
$pattern = '/ /';
$string2 = preg_replace ($pattern, ' +',$trimmed);
How do I avoid preg_replace to put a + in front of each word if that word has a * ?
Thanks