On Wed, 2006-09-06 at 11:03 -0600, Ashley M. Kirchner wrote: > Robert Cummings wrote: > > It's because you have written sloppy code and didn't bother to > > initialize $Dirs to an array. So it's default value is null. You would > > know this if you had notices enabled. > > > Error fixed. > > > Also, the other problem is that you are either a) opening the wrong > > path, b) the path you are opening has no files or directories. > > > Neither of those assumptions is correct. Well then, perhaps you should add some echos so you can see exactly how your code is executing. I do know for certain that if $Dirs was nul when passed to sort() that the following never saw the light of day with respect to processor time: <?php $Dirs[$i] = $dh; ?> While I'm looking at it btw, $i is completely pointless. You should use: <?php $Dirs[] = $dh; ?> Since the index will be automatically incremented by 1 for each entry added. But hey! Whadda I know?! > > > Take note also that your variable is called $Dirs, but readdir() returns > > all directory contents (including files, links, etc, etc). > > > I'm aware of what readdir() returns, and also aware that in my > particular application, it makes no difference what so ever since there > are only directories in there. If it also contained individual files, I > would've named it different. Variable names are exactly that, variable > names. Whether I called it $Dirs or $Robert_Cummings would make no > difference what so ever [to me]. But thank you for your opinion. You're very welcome. I hope you're not writing code for a customer of some sort. I'd hate to be the one maintaining it after you abandon it... even if it does have variables named after me (thanks for that). I hope you initialized $Robert_Cummings btw, I'm not sure I want to be an implicit null. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php