while($c=fgets(STDIN)){
if($c===PHP_EOL){
continue;
}
else {
echo $c;
}
}
When the above code is called from the command line in php 5.3.8, it prints the rows in the input file, and skips any empty lines. However, in php 5.2.6, it does not skip over the empty lines.
Is there any way of changing the code to make it skip over empty lines in the lder versions as well?
If you change the condition to
This should work on any platform.
See ord