Have a look at the link I posted with it.
In short: you set a counter to zero ($i). Then you open a file (fopen()), and start reading from it, while you are not at the end of file (wile(!feof($fd)))
The 4096 has to do with the length of the string to be read. I am not sure why it is that number (I have not used the function myself). I'd suggest you try like this on a short file (say 100 lines), and perhaps alter the number here and there, and see what happens.
Good luck,
J