Re: readdir() question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux