If it were just spaces, it would be a case of
$partes = explode( ' ', $todo );
A solution, depending on what you want, would be to force a space before the characters you want to treat as isolated:
$todo = str_replace( array( '.', ',' ,'?' ), array( ' .', ' ,', ' ?'), $todo );
$partes = explode( ' ', $todo );
See working on IDEONE.
Note that I have placed the valid separators directly in the replace, but if you want to do this with a string, it compensates for a more complex function.
If you prefer to consider all alphanumeric symbols separately, you can use a Regex, and solve in one line:
preg_match_all('~\w+|[^\s\w]+~u', $todo, $partes );
See working on IDEONE.
In addition, it would be the case to add spaces before and after the symbols, remove double spaces, depending on the criterion. The intention of the answer was only to give an initial direction.
Wonderful! Thank you ;)
– C-lio Garcia
cool! (+1)... preg_match_all : php is better than I thought!
– JJoao
@Jjoao is only a wrapper, the implementation is PCRE, PHP only accesses third-party lib functionality. It would be the same thing in Harbour or any language that accesses that lib.
– Bacco