puoi usare le funzioni per il controllo dell'output, ovvero http://it2.php.net/manual/it/ref.outcontrol.php