PHP scandir Function: List Files and Directories in a Specified Path
The PHP scandir function returns an array of filenames and sub‑directories from a given directory, optionally sorted in ascending or descending order, and can accept a stream context, providing FALSE on failure and generating a warning if the path is not a directory.
The PHP scandir function returns an array of files and directories contained in a specified directory.
Syntax: array scandir(string $directory[, int $sorting_order[, resource $context]])
Parameters :
directory : the directory to be scanned.
sorting_order : optional; default is alphabetical ascending. If set to 1, sorting is alphabetical descending.
context : optional stream context resource (see manual for details).
Return value : on success, an array of filenames; on failure, FALSE . If $directory is not a directory, FALSE is returned and a PHP E_WARNING is generated.
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.