RE: [PHP] Re: fgets() question?
| From: | Ford, Mike [LSS] | Date: | Mon, 23 Dec 2002 12:27:09 +0000 |
| Subject: | RE: [PHP] Re: fgets() question? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-129169@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Noel Wade [mailto:noel_wade@hotmail.com]
> Sent: 22 December 2002 09:44
>
> > A blank line should return the newline (\n or \r\n),
> according to
> > http://www.php.net/manual/en/function.fgets.php. Also try
> using '===' (3 =
> > signs) as the operator, which enforces type checking on a
> comparison).
>
> Yes or no:
>
> $foo == FALSE === 0;
Erm -- no, I think. At any rate, FALSE===0 is false! Is that what you meant?
>
> Right now I'm just doing
>
> if($foo)
>
> And "\n" seems to equate to FALSE with this sort of conditional /
> comparison...
Well, it shouldn't, so I'm beginning to suspect that your $foo doesn't contain what
you think it does. According to the PHP manual, 'the following values are considered FALSE:
the boolean FALSE itself; the integer 0 (zero); the float 0.0 (zero); the empty string, and the
string "0"; an array with zero elements; an object with zero member variables; the special
type NULL (including unset variables)'.
As "\n" is none of those, it should be ==TRUE (but, of course, !==TRUE).
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211