LWN.net Logo

PHP has some unique properties?

PHP has some unique properties?

Posted Dec 9, 2008 12:54 UTC (Tue) by nix (subscriber, #2304)
In reply to: PHP has some unique properties? by khim
Parent article: PHP 5.2.7 withdrawn

SQL (and its bastard children like PgSql, PL/SQL et al) have this lovely characteristic too if you're dealing with NULLs.

(For that matter, IEEE754 requires these semantics when comparing floating point numbers if one of the numbers in the comparison is a NaN.)


(Log in to post comments)

Good answer

Posted Dec 9, 2008 13:12 UTC (Tue) by khim (subscriber, #9252) [Link]

That's two cases I knew as well. But in both SQL and C disaster is localized: in SQL you can use "NOT NULL" mark to make sure there will be no NULL in the column, in C you can avoid floating point altogether (and floating point numbers are anomany in many other reasons). In PHP there are no simple rule to avoid this.

Actually all languages can be marked as "nice", "bad, but unavoidable" and "bad AND avoidable". Python and Java are first (they do have problems but overral they are "nice"), C/SQL/JavaScript are second (have nasty surprises but almost impossible to avoid in practice) and PHP is in the last category.

Good answer

Posted Dec 10, 2008 11:17 UTC (Wed) by ballombe (subscriber, #9523) [Link]

Why special casing C over this ? The IEEE754 standard is not C specific, other languages support it (C++, etc) and have the exact same issue.

In the end it is more of a hardware issue (if you want to use the FPU of your machine in a portable way, you have to deal with IEEE754 semantic).

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds