Reply to Re: TRUE and FALSE are treated differently

Your name:

Reply:


Posted by Rik Wasmus on 01/06/08 20:03

On Sun, 06 Jan 2008 20:38:01 +0100, Puzzled <scratching.head@example.com>
wrote:

> On Sun, 06 Jan 2008 19:53:43 +0100,
> Michael Fesser <netizen@gmx.de> wrote:
>
>> Second: If you print out a boolean, its value is automatically converted
>> to a string. How and why this is done is described in the manual:
>>
>> | A boolean TRUE value is converted to the string "1", the FALSE value
>> | is represented as "" (empty string). This way you can convert back and
>> | forth between boolean and string values.
>
> You don't find that a daft convention? It implies that true has
> an integer value that can undergo autoconversion in a string
> context but false has no value and cannot. I can't find any
> sense in that at all.

You assume some things which are just not right, to clarify:
1. An empty string is still as string, the fact that it's empty should not
matter.
2. True doesn't have an 'integer value', it's just that PHP is loosely
typed, with clearly defined casts when converting one into the other.
3. The types of variables PHP has are limited and clearly defined. Don't
assume they're actually something else, a boolean IS a boolean, not just
some mask of an integer, string, or something else.
--
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

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