PHP Salt


A little dash of PHP... my collection of php functions

Version: 2.14.1
Last Build: March 10, 2017 13:28pm (PST)

psDirList()
Dir - list of Dir


Description:

Returns an (array) list of subdir in a directory
Key is set to "dir_searched/dir"


Usage:

$aryList = psDirList("/tmp");


Example:






Code:

function psDirList($wDir)
{
if (file_exists($wDir) == false) { return; }
$handle = opendir($wDir);
while (false !== ($entry = readdir($handle)))
{
if ($entry != "." && $entry != "..")
{
if ( is_dir("$wDir/$entry") == true ) { $res["$wDir/$entry"] = $entry; }
}
}
closedir($handle);

asort($res);
return $res;
}


Changlelog:


See Also

And a shot out to:

LinuxSimple - www.linuxsimple.com
PHP - php.net
Fedora Server - getfedora.com
Shameless ads to pay for site