You are here: Re: Passing Boolean to a Function « PHP Programming Language « IT news, forums, messages
Re: Passing Boolean to a Function

Posted by David Haynes on 07/11/06 12:06

Rik wrote:
>> $row['isarchived'] is already a 0/1 value (Tinyint(1)), so really the
>> (bool) cast is a no-op. My bad. You could just use $isArchived =
>> $row['isarchived']
>
> What do you mean by no-op? I'm no native speaker, please explain. And
> already 0/1? 0/1 is an integer, not a boolean.

Due to the loose type association false (boolean) == 0 (integer).
Similarly, true (boolean) == (not) 0 (integer)

So, given that a Tinyint(1) can only return 0 and 1 this has a direct
1:1 mapping through the implied type casting of PHP to false and true.

That's what I meant by no-op (PHP will handle it for you)

-david-

 

Navigation:

[Reply to this 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

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