Re: readdir() question

From: Date: Tue, 15 Aug 2006 22:56:04 +0000
Subject: Re: readdir() question
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-240741@lists.php.net to get a copy of this message
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

« previous php.general (#240741) next »