|
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]
|