2010/10/15 Iñaki Baz Castillo <i...@aliax.net>: > 1) Never do implicit type conversion. This is, a string is NEVER equal > to an integer: > > if "0" == 0 => false > if "" == 0 => false > if "asdasd" == 0 => false > > > 2) An integer is NEVER equal to a string: > > if 0 == "0" => false > if 0 == "" => false > if 0 == "asdasd" => false > > > 3) Integer 0 is not equal to NULL: > > if 0 == NULL => false > > > 4) Empty string is not equal to NULL: > > if "" == NULL => false > > > 5) Integer 0 is true: > > if 0 => true > > > 6) Empty string is true: > > if "" => true
These simple rules avoid stupid problems (as they occur in PHP): http://www.otton.org/2008/08/06/stupid-php-tricks-true-false-comparison/ -- Iñaki Baz Castillo <i...@aliax.net> _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users