Re: Implied cast differs from explicit cast [message #176679 is a reply to message #176669] |
Tue, 17 January 2012 02:35 |
lb
Messages: 4 Registered: January 2012
Karma:
|
Junior Member |
|
|
Thanks to all who replied, more or less...
I was not trying to convert hex to decimal or any such thing. I was
cleaning up some code that looked something like this:
if (is_numeric($data[$i])) {
$val = (double)$data[$i++];
...
} else {
$i++;
}
I changed it to:
if (is_numeric($val = $data[$i++])) {
...
}
During testing I found that I could get different results within the
block with $val used as a numeric value in calculations. The difference
was when a string containing a hex value was used in the data array.
This is odd behavior, and inconsistant, in my opinion, and might be
considered a PHP bug.
|
|
|