OT - Bizarre PHP problem/bug

Ryan Byrd ryanbyrd at gmail.com
Mon Nov 22 17:28:48 MST 2010


> Basically I found the problem.  PHP is trying to cast my string
> as a number, and so any string is always equal to zero.  Brilliant.  PHP
> rocks!

Yup. PHP string conversion to numbers:

When a string is evaluated in a numeric context, the resulting value
and type are determined as follows.

...

The value is given by the initial portion of the string. If the string
starts with valid numeric data, this will be the value used.
Otherwise, the value will be 0 (zero).

http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion


More information about the PLUG mailing list