How to compress files in PHP with compress.zlib:// and compress.bzip2:// streams (and with gzopen() and bzopen()).
Author: BrainBell
Recursive Directory Iterator
How to use DirectoryIterator and RecursiveDirectoryIterator classes to loop through all files and folders inside a directory.
Reading Directories Contents
How to browse the file system with the help of PHP functions.
Copying, Moving and Deleting Files
Learn how to rename, move, copy or delete files in PHP.
Reading Information About Files
Learn how to get all file information, for example, get modification time with filemtime(), get last access time with fileatime(), get group id with filegroup(), get user id with fileowner(), get size with filesize() and use the stat() function to get all information (meta data) about a file.
File Permission
Learn how to use the is_executable(), is_readable(), is_writable(), fileperms(), and chmod() functions to determine whether your PHP script has permission to execute, read or write a particular file.
How to check the type of a file. For example, check whether the provided file name is a directory, a file, or a symbolic link.
Parsing INI Strings and Files
Let’s write the PHP configuration information, such as the database host and user credentials, in an INI file. Then use the parse_ini_file() function to parse this information in your web application.
Reading and Writing CSV Files
CSV is a file format and stands for “comma-separated values”. In this tutorial, we use the fgetcsv() function to read a CSV file and fputcsv() function to write CSV records into a file.
Writing or Appending to Files
Writing to files is as easy as reading from them. In this tutorial, we’ll use the file_put_contents() and fwrite() functions to write and append to files. You’ll also learn how to lock files to avoid trouble when one process writes while the other one reads.