Code has been added to clipboard!

The Complete Guide on PHP Directory: Master Functions

Reading time 2 min
Published Aug 8, 2017
Updated Oct 2, 2019

A PHP directory is a structure used to catalog and keep our files. It's a part of an organizing system that lets us keep track of our projects and code files more easily.

PHP has a bunch of inbuilt functions that let us quickly fetch information about particular PHP files in the directory. Additionally, it is possible to retrieve data about a whole specific PHP directory. We can easily make PHP list files in directory, open specified handles, and perform other tasks.

PHP Directory: Main Tips

  • Directory functions allow you to get info about various PHP directories and what they contain.
  • These functions are inbuilt into the PHP's core.

List of Useful Functions

The following list contains the functions you can apply in order to manipulate every PHP directory you create:

Function Description
chdir() Change current PHP directory
chroot() Change root directory
closedir() Close directory handle
dir() Return instance of directory class
dirname() Make PHP get root directory
getcwd() Return current working PHP directory
opendir() Open specified directory handle
readdir() Return entry from directory handle
rewinddir() Reset directory handle
scandir() Make PHP list files in directoryReturn array of PHP files in directory specified (or directories from multidimensional array)

PHP Directory: Summary

  • Information on any PHP file directory and the files it contains can be obtained using PHP directory functions.
  • These functions are inbuilt, and therefore don't require installation.
Tutorial
Introduction
Installation
Syntax
Variable
Superglobals
Data Types
String
Array
Multidimensional Array
Sort Array
Constant
Operators
Cookies
Sessions
DateTime
Error Handling
Exception Handling
File
Write and Create File
File Open, Read and Close
File Upload
Filtering
Redirecting
Advanced Filters
Forms
Form Required Field
Validate Email/URL
Form Validation
Form Action
Function
Prepared Statements
JSON
Calendar
ZIP File
FTP
HTTP Response
DateTime Functions
Error Functions
File Function
Filter
Math Functions
Mail Function
Miscellaneous Functions
Date Format
String Functions
Array Functions
Directory Functions
MySQL Database
MySQL Connection
MySQL Create Database
MySQL Create Table
MySQL Delete Data
MySQL Insert Data
MySQL Get Last Record ID
MySQL Insert Multiple Records
MySQL Select Data
MySQL Limit Data
MySQL Update Data
MySQLi Functions
AJAX and MySQL
AJAX Search
AJAX Poll
RSS Reader
Read XML File in PHP
XML Parser
SimpleXML Parser
SimpleXML: Node and Attribute
Expat XML Parser
DOMDocument
Libxml Functions
SimpleXML Functions
XML Parsing Functions
PHP isset
PHP echo and print
PHP if else and elseif
PHP switch case
PHP include File
PHP while Loop
PHP for and foreach
PHP mail()
PHP explode()
PHP substr()
PHP str_replace()
PHP array_push
PHP count()