php developers generally don’t put a lot of thought into reading files from disk. we usually just call file
or file_get_contents
or similar, shovel the whole thing into ram, and then fight with the resulting array or string. if we want to do simple things with small files, it works okay. but php can do a lot more.
in this article, we’re going to look at php’s file pointer and how to manipulate it using commands like fseek
and ftell
, and by the end we’ll be able to build a pure php version of linux’s tail -f
command.
