Gen. partnerAlgotech

PHP function scandir()

List files and directories inside the specified path

|
September 11, 2019

Availability in PHP 5.0

List files and directories inside the specified path

Parameters

Parameter Data type Default value Note
$directory string not The directory that will be scanned.
$sorting_order int null, By default, the sorted order is alphabetical in ascending order. If the optional sorting_order is set to non-zero, then the sort order is alphabetical in descending order.
$context resource null For a description of the context parameter, refer to the streams section of the manual.

Return values

array

an array of filenames on success, or false on failure. If directory is not a directory, then boolean false is returned, and an error of level E_WARNING is generated.

Additional resources

Official scandir documentation

Loading comments...

Stay in the loop

Subscribe to our newsletter and get the latest cybersecurity news delivered straight to your inbox.

Your data is safe. You can unsubscribe from the newsletter at any time.