Usually, files are opened (or searched) relative to the path of the document. To be sure that you are searching for the current script’s path, you can use a two-step approach: The constant __FILE__ contains the full path of the current script, and the function dirname() determines the directory name portion of a path.
Author: BrainBell
ZipArchive – Zip and Unzip Files and Folders
Let’s create a compressed Zip archive in PHP with ZipArchive class, which provides many features for reading and writing Zip archives.
How to compress files in PHP with compress.zlib:// and compress.bzip2:// streams (and with gzopen() and bzopen()).
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.