Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3251

Re: Setting variable to false in a WHILE loop

Message-ID <3104939.FHjZrv7YcN@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2011-10-01 16:08 +0200
Subject Re: Setting variable to false in a WHILE loop
Newsgroups comp.lang.php
References <a1536ef2-b1a4-473c-a6e8-93d1a7c800e2@k6g2000yql.googlegroups.com> <j5kl4c$mbs$1@dont-email.me> <9281403.1198.1317234500379.JavaMail.geo-discussion-forums@yqma37>
Followup-To comp.lang.php

Followups directed to: comp.lang.php

Show all headers | View raw


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

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Setting variable to false in a WHILE loop jwcarlton <jwcarlton@gmail.com> - 2011-09-23 20:53 -0700
  Re: Setting variable to false in a WHILE loop Jerry Stuckle <jstucklex@attglobal.net> - 2011-09-24 09:14 -0400
    Re: Setting variable to false in a WHILE loop tamouse <tamouse.lists@gmail.com> - 2011-09-28 11:28 -0700
      Re: Setting variable to false in a WHILE loop Tim Streater <timstreater@greenbee.net> - 2011-09-28 20:49 +0100
      Re: Setting variable to false in a WHILE loop Doug Miller <doug_at_milmacdotcom@example.com> - 2011-09-29 08:09 -0400
      Re: Setting variable to false in a WHILE loop Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-01 16:08 +0200

csiph-web