[PHP-DEV] '1.8' == 1.8 can return false

2008-04-11 Thread Todd Ruth
I'm thinking there must be a bug in the heart of php causing this. I'll debug it, but I haven't looked at php source code in a few years and would like a tip as to which files are involved in evaluating "==". Here is a fragment from my code and the output: ... print "\n"; var_dump($max); var_dum

Re: [PHP-DEV] '1.8' == 1.8 can return false

2008-04-11 Thread Rasmus Lerdorf
There is no bug here. Please read: http://docs.sun.com/source/806-3568/ncg_goldberg.html -Rasmus Todd Ruth wrote: I'm thinking there must be a bug in the heart of php causing this. I'll debug it, but I haven't looked at php source code in a few years and would like a tip as to which files ar

Re: [PHP-DEV] '1.8' == 1.8 can return false

2008-04-11 Thread Todd Ruth
I'd take that as proof of a design flaw in having php doing string to float comparison by casting the string to float instead of the float to a string, but you've got me - the documentation does say the string will be converted to a float and not vice-versa. If it wouldn't be a bad BC break, I th

Re: [PHP-DEV] '1.8' == 1.8 can return false

2008-04-11 Thread Todd Ruth
Clicked Send too fast. For the suggestion box, let me instead suggest that for string $s and float $f: $s == $f (a string being compared to a float) be the same as (string)(float)$s === (string)$f instead of (float)$s === $f (as it is today if my understanding is correct) Since the current beh

[PHP-DEV] '1.8' == 1.8 can return false or yet another example of the uselessness of type juggling.

2008-04-12 Thread Richard Quadling
On 12/04/2008, Rasmus Lerdorf <[EMAIL PROTECTED]> wrote: > There is no bug here. Please read: > > http://docs.sun.com/source/806-3568/ncg_goldberg.html > > -Rasmus So, would I be right in thinking that the only time type-juggling is 100% successful is between strings and integers? -- -

Re: [PHP-DEV] '1.8' == 1.8 can return false or yet another exampleof the uselessness of type juggling.

2008-04-12 Thread Christian Schneider
Stefan Walk schrieb: Richard Quadling schrieb: On 12/04/2008, Rasmus Lerdorf <[EMAIL PROTECTED]> wrote: There is no bug here. Please read: http://docs.sun.com/source/806-3568/ncg_goldberg.html -Rasmus So, would I be right in thinking that the only time type-juggling is 100% successful is

Re: [PHP-DEV] '1.8' == 1.8 can return false or yet another example of the uselessness of type juggling.

2008-04-12 Thread Stefan Walk
Richard Quadling schrieb: On 12/04/2008, Rasmus Lerdorf <[EMAIL PROTECTED]> wrote: There is no bug here. Please read: http://docs.sun.com/source/806-3568/ncg_goldberg.html -Rasmus So, would I be right in thinking that the only time type-juggling is 100% successful is between strings and i