A while back, the O'Reilly Network posted part one of an article about working with files in PHP. Well, the follow-up to that piece, Working with Files in PHP, Part Two has been posted.
Last time I introduced you to the basic file access methods available to PHP: fopen(), fputs(), and fgets(). Although very useful, these functions work only with strings. This week I'll introduce to you more advanced file access functions that read and write binary files. We'll talk about fread() (used for reading), fseek() (used to find specific parts of a given file), along with a few other useful file access functions.
Most people just starting out with PHP don't even know that these kinds of functions exist (oddly enough). I've had lots of people ask me if PHP can open files or write a file before checking the manual for such functions (the cardinal sin), but once they find them, a whole new world is opened to their scripts. There'll be more to come in this series, so keep an eye out for more advanced topics to come...




