Re: sort() warning

From: Date: Wed, 06 Sep 2006 17:03:31 +0000
Subject: Re: sort() warning
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-241423@lists.php.net to get a copy of this message
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.
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.


« previous php.general (#241423) next »