PHP Salt


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

Version: 2.33.2
Last Build: December 29, 2023 20:28pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
db
file
graph
html
mail
math
misc
mobile
script
string
system
time
web
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)
{
$res = array();
if (file_exists($wDir) == false) { return; }
$res = array();
$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:

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