Reply to Re: TRUE and FALSE are treated differently

Your name:

Reply:


Posted by Rik Wasmus on 01/06/08 19:28

On Sun, 06 Jan 2008 20:23:15 +0100, Michael Fesser <netizen@gmx.de> wrot=
e:

> .oO(A Bit Narked)
>
>> On Sun, 06 Jan 2008 19:43:28 +0100,
>> "Rik Wasmus" <luiheidsgoeroe@hotmail.com> wrote:
>>
>>> Ah, taking a closer look at your post, I'd say this: you cannot echo=
=

>>> true
>>> or false, they have no string value. PHP has loose typing, and false=
=

>>> cast
>>> to string would be '', cast to integer would be 0, the fact is that =
the
>>> underlying value of false is not 0 (yes, it would be in C probably, =
but
>>> not from the PHP side of things).
>>
>> And yet you can echo true. The output is '1'. You can also
>> concat it into a string, where it also becomes a 1. The two
>> constants are treated completely differently in that respect.
>
> Nope. Both are just converted to a string:
>
> TRUE =3D> non-empty string ('1', but it could be anything)
> FALSE =3D> empty string

AH, for some reason, can't see the previous post Michael comments on, bu=
t =

indeed, echo will convert any variable to string it recieves. That's for=
=

instance how it's possible to define a __toString() method on an object.=

-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация