HomePHP Page 9 - File And Directory Manipulation In PHP (part 1)
A Short Break - PHP
PHP comes with a powerful and flexible file manipulation API that allows developers (among other things) to read and write files, view and modify file attributes, read and list directory contents, alter file permissions, and retrieve file contents into a variety of native data structures. Find out more, inside.
And that's about all we have time for. Over the last few pages, I offered you a gentle introduction to PHP's file manipulation functions, showing you alternative ways to read and write files on the file system. I also showed you how to obtain detailed status information on any file, including data on attributes like file size, permissions, ownership, et al.
This isn't all, though. PHP also comes with a whole bunch of other, more specialized file and directory functions, which let you copy, delete and rename files; scan directories; work with remote files over HTTP and FTP; perform pattern matches on file names; and read and write to processes instead of files. All that, and more, in the concluding segment of this tutorial - so make sure you come back for that!
Note: Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!