fork download
  1. <?php
  2.  
  3. $todo = 'Eu irei amanhã à casa. E tu vens?';
  4.  
  5. $todo = str_replace ( array( '.', ',' ,'?' ), array( ' .', ' ,', ' ?'), $todo );
  6. $partes = explode( ' ', $todo );
  7.  
  8. print_r( $partes );
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Eu
    [1] => irei
    [2] => amanhã
    [3] => à
    [4] => casa
    [5] => .
    [6] => E
    [7] => tu
    [8] => vens
    [9] => ?
)