01-21-2009, 06:49 PM
|
#2 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
The easiest, and quite possibly the best way, would be to use the glob function. Please have a read of this article. Once you have that, you simply array_reverse the array, and that gives you them in reverse order. Please take a look at the following code; you would want the descending function:
php Code:
function TalkPHP_Dir_Display_Asc ($szGlobExpression){ return glob($szGlobExpression, GLOB_ONLYDIR ); }function TalkPHP_Dir_Display_Desc ($szGlobExpression){ $aDirs = glob($szGlobExpression, GLOB_ONLYDIR ); return array_reverse($aDirs); }$aDirs = TalkPHP_Dir_Display_Desc ('./*'); $aDirs = array_map('basename', $aDirs); echo 'Directories: ' . implode(', ', $aDirs);
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|