php-general | 2001032
Date: 03/31/01
- Next message: Yasuo Ohgaki: "Re: [PHP] Compiling under RH7"
- Previous message: Christian Dechery: "[PHP] registering an array into a session (?)"
- In reply to: George Schlossnagle: "[PHP] [Fwd: php...]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Yasuo Ohgaki: "Re: [PHP] Compiling under RH7"
- Previous message: Christian Dechery: "[PHP] registering an array into a session (?)"
- In reply to: George Schlossnagle: "[PHP] [Fwd: php...]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

