I am trying to read a file line by line. Then print only the lines that match the variable length. If the $maxLength is set to 5, then print only the ones that are no more than 5 characters long.
I open the file. I know each line gets stored into the $output. How do I find the matching length?
Any help is greatly appreciated.
if($handle)
{
while (!feof($handle))
{
$output = fgets($handle, 4096);
}
}
1 Answer