FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » strange behaviour in assignment expr.
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: strange behaviour in assignment expr. [message #172849 is a reply to message #172848] Sat, 05 March 2011 13:20 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 3/5/2011 8:02 AM, Marc van Lieshout wrote:
> I try to read in a source file, line by line, within a loop
>
> This works:
>
> $text = fgets($fh);
> if ($text === false)
> break;
>
> This doesn't, and always breaks on the first line:
>
> if (($text = fgets($fh)) === false)
> break;
>
> What's wrong with that? Am I missing something?

It should work. Check your code again. I suspect you may be using
"==", which will break on an empty string, instead of "===", which will not.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: [ANN]VTD-XML 2.10
Next Topic: having trouble using gd imageline in foreach loop
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 19:45:34 GMT 2024

Total time taken to generate the page: 0.06560 seconds