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

Home » Imported messages » comp.lang.php » Setting variable to false in a WHILE loop
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Setting variable to false in a WHILE loop [message #175478 is a reply to message #175453] Sat, 01 October 2011 14:08 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
tamouse wrote:

> On Saturday, September 24, 2011 8:14:46 AM UTC-5, Jerry Stuckle wrote:
>> Why complicate things? Why not just use
>>
>> if ($text !== false)
>
> That works, but might be a little opaque. I'd use:
>
> if (!empty($text))
>
> As it's a little more clear to the reader/maintainer.

It is not equivalent, though:

<http://php.net/empty>

> Also, with the === & !== idiom, isn't it better reverse the operands,
> thus:
>
> if (FALSE !== $text)
>
> ?

No. Why should it be?

(The PEAR Coding Standards also actively recommend against writing `false'
as `FALSE': <http://pear.php.net/manual/en/standards.naming.php>)


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Contact Form
Next Topic: OCI.DLL and libcs.dll?
Goto Forum:
  

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

Current Time: Fri Sep 20 19:20:44 GMT 2024

Total time taken to generate the page: 0.05012 seconds