<pre>
$lines=file('readerfile.txt');
$fp=fopen('writerfile.txt','w');
var_dump($lines);
foreach($lines as $line){
if($line=='\r\n' || $line=='\n' || $line=='\r' || $line==' ' || empty($line) || strlen(trim($line))==0){
echo '123';
}
else{
fwrite($fp,$line);
}
}
</pre>
watch the below picture:
<a href="http://ashique12009.files.wordpress.com/2011/07/newlineremover.jpg"><img class="alignnone size-full wp-image-75" title="newlineremover" src="http://ashique12009.files.wordpress.com/2011/07/newlineremover.jpg" alt="" width="450" height="129" /></a>
$lines=file('readerfile.txt');
$fp=fopen('writerfile.txt','w');
var_dump($lines);
foreach($lines as $line){
if($line=='\r\n' || $line=='\n' || $line=='\r' || $line==' ' || empty($line) || strlen(trim($line))==0){
echo '123';
}
else{
fwrite($fp,$line);
}
}
</pre>
watch the below picture:
<a href="http://ashique12009.files.wordpress.com/2011/07/newlineremover.jpg"><img class="alignnone size-full wp-image-75" title="newlineremover" src="http://ashique12009.files.wordpress.com/2011/07/newlineremover.jpg" alt="" width="450" height="129" /></a>
No comments:
Post a Comment