$line = fgets($myfile,5000);
This "gets" the first line of the $myfile file and assigns it to the variable $line.
Each time the while loop comes back to this command, it will get the next line, and then the next line, and so on.
The 5000 means that each line can be up to 5000 characters long.