Given this piece of code:
$i = 0;
if ($dir = opendir($path)) {
while ($dh = readdir($dir)) {
if ($dh != '.' && $dh != '..') {
$Dirs[$i] = $dh;
$i++;
}
}
}
closedir($dir);
sort($Dirs);
Why does sort() give me the following warning:
PHP Warning: sort() expects parameter 1 to be array, null given in ....
The array contents is as follows ( according to print_r($Dirs) )
Array
(
[0] => 1029
[1] => 1197
[2] => 1254
[3] => 1093
[4] => 1217
[5] => 1272
[6] => 1233
[7] => 1257
[8] => 1017
[9] => 1033
)
The end result I want is that it sorts out that array in ascending
order, thus 1017, 1029, 1033, 1042, etc., etc...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php