PHP has type juggling feature. PHP4 supports "total equality"(?) operator "===".
If you need variable to be match for both type and value. Use "===", then you
can avoid type juggling.

http://www.php.net/manual/en/language.types.type-juggling.php
http://www.php.net/manual/en/language.operators.comparison.php

Regards,
--
Yasuo Ohgaki

> I'm sure you appreciate the importance of transitive equality in programming
> languages (especially they all aspire to be pseudo-mathematical), which is
> why I think you'll appreciate this.
>
> <?php
>
> $a = "0";
> $b = 0;
> $c = "";
> $d = "       ";
>
> $a == $b  // T
> $b == $c  // T
> $a == $c  // F!!
>
> $b == $c  // T
> $b == $d  // T
> $c == $d  // F!!
>
> ?>
>
> Perl, of course, outputs the expected values: $a, $b, $c and $d are equal
> under '==', and only $a and $b are equal under 'eq'. PHP's '===' operator
> (its equivalent to 'eq') says that $a, $b, $c and $d are all different.
>
> Doesn't that seem like a fundamental flaw? How can equality NOT be
> transitive?? How can anyone be expected to write programs in such an
> environment?
>
> D
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to