Re: [PHP] sort() warning

2006-09-06 Thread Robert Cummings
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. >

Re: [PHP] sort() warning

2006-09-06 Thread Ashley M. Kirchner
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) t

Re: [PHP] sort() warning

2006-09-06 Thread Robert Cummings
On Wed, 2006-09-06 at 10:47 -0600, Ashley M. Kirchner wrote: > Given this piece of code: > > $i = 0; > if ($dir = opendir($path)) { > while ($dh = readdir($dir)) { > if ($dh != '.' && $dh != '..') { > $Dirs[$i] = $dh; > $i++; > } > } > } > closedir($

[PHP] sort() warning

2006-09-06 Thread Ashley M. Kirchner
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(