Beware of NaN and strings in PHP.
In other languages (and specifically in Javascript) math operations with non-numerical strings will result in NaN, while in PHP the string is silently converted to 0.
So any test like:
is_nan('hello, string'); // false
gives the impression that the string is a valid number.