Hi everyone,
Just discovered a bug in my coding and not sure how to resolve it off the top of my head. The thing is I have used this function extensively so I dont want to be making too many changes to it if possible. So i have a loop that gives me $file... how do I sort that? my code goes into a folder, prints the results but the order is all wrong. I guess it is sort non-alphabetically.
this is my code:
<?php
$path = "./mydir/"; // even "."
if ($dir = @opendir($path)) {
while (($file = readdir($dir)) !== false) {
if ($file=='.' || $file=='..' || $file=='_vti_cnf') continue;
if (is_dir($path."/".$file)) {
echo "$file<br>";
}
}
}
?>
this is my results:
vcd
vav
hdld
jtc
rd001
utt
ad
iris
fd
bargrille
backdraft
floorbargrill
lighttroffer
fb
fl
ddg
any help would be muchly appreciated...
Thanks
Chris