Re: readdir() question

From: Date: Tue, 15 Aug 2006 23:36:33 +0000
Subject: Re: readdir() question
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-240748@lists.php.net to get a copy of this message
On Tue, August 15, 2006 5:56 pm, John Meyer wrote: > Richard Lynch wrote: >> On Tue, August 15, 2006 12:04 pm, John Meyer wrote: >>> I have a script to list the files in a directory: >>> >>> <select name="letters"> >>> <?php >>> $open = opendir("."); >>> while ($file = readdir($open) != false) { >>> ?> >>> <option value="<?=$file?>"><?=$file?></option> >>> <?php >>> } >>> ?> >>> </select> >>> </form> >>> >>> And all I am getting are "1"s. I think I'm doing it right, what is >>> the >>> disconnect? >> >> It's not a readdir question. It's an Order of Operations question. >> :-) >> >> $file = readdir($open) != false >> >> You probably believe that PHP is going to magically "know" that you >> want this bit: >> readdir($open) != false >> to be done "first" >> > > > No, and I fixed that. What I'm wondering about is why this > > false !== ($dirhandle = opendir('letters')) > > works, but this > > ($dirhandle = opendir('letters')) != false > does not Do you really mean opendir() or do you mean readdir() ??? What value are you getting for $dirhandle? echo it out and see what it is. You also have != in one, and !== in the other. Those aren't the same. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#240748) next »