Yep, we should. It came up many times over the years, this behavior
haven't changed since early PHP 3.0.0...
Zeev
At 19:47 9/2/2001, Zak Greant wrote:
>Zeev Suraski wrote:
> > At 17:59 9/2/2001, [EMAIL PROTECTED] wrote:
> > >ID: 9186
> > >User Update by: [EMAIL PROTECTED]
> > >Status: Bogus
> > >Bug Type: Scripting Engine problem
> > >Description: string compare with "==" does not work correctly
> > >
> > >I think there is no reason to convert any type if both
> > >operands of the comparision are of the same type. It costs
> > >time and it's completely not necessary. This is a bug.
> >
> > No, it's not a bug. It's definitely an intended behavior.
> > PHP does it's best to do the 'right thing' in the most common
> > cases. Because of the way it works, effectively, comparing strings that
> > 'look like numbers' as if they were numbers makes life much, much easier.
> > If you want to enforce a string comparison, use strcmp().
>
> We should document this behavior then - it could lead to problems
> that are very hard to track down!
>
> --zak
--
Zeev Suraski <[EMAIL PROTECTED]>
CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]