puoi usare la funzione split
http://php.net/manual/en/function.split.php