If you right click and View Source it will not be on one line. Otherwise, replace "\n" with "<br>" for html output.
Revised code to remove extra chars.
PHP Code:
<?php
if ( ( $file = file( "file.txt" ) ) !== false )
{
foreach( $file as $line )
{
$words = explode( " ", trim( $line ) );
foreach( $words as $word )
{
$word = ereg_replace( "[^A-Za-z0-9]", "", $word );
if ( strlen( $word ) > 3 )
{
echo $word . "\n";
}
}
}
}
?>