Re: [PHP-DEV] [RFC] Binary String Comparison

[email protected] (Marc Bennewitz)
Newsgroups php.internals
Message-ID <[email protected]>
On 18.08.2014 14:53, Pierre Joye wrote:
> hi,
>
> On Mon, Aug 18, 2014 at 2:44 PM, Marc Bennewitz <[email protected]> wrote:
>>
>>
>> On 17.08.2014 22:18, Sara Golemon wrote:
>>>
>>> On Sun, Aug 17, 2014 at 12:58 PM, Marc Bennewitz <[email protected]> wrote:
>>>>
>>>> I've created a draft RFC and patch to change the behavior of non-strict
>>>> string to string comparison to be binary safe (as the strict comparison
>>>> operator does):
>>>>
>>>>        https://wiki.php.net/rfc/binary_string_comparison
>>>>
>>> If I understand your goal correctly, you seem to want to change a very
>>> fundamental (and ancient) behavior of the language even though
>>> mechanisms already exist to do what you describe as the "changed
>>> behavior".
>>>
>>> What exactly is wrong with ===, strcmp(), etc..?
>>
>>
>> The question isn't "What's wrong with ===, strcmp()?" but "What's wrong with
>> ==, <, >?".
>
> And the answer is: not strict and why === exists.

Non-strict comparison should do conversion to make both operands 
comparable. It should not convert both operands into a third unrelated 
type that wasn't mentioned.

Btw. The RFC doesn't handle == and === the same because == *do* 
type-juggling but only if both operands are not on the same type.

strcmp() isn't the same behavior as it first converts both operands into 
a string.

>
> Cheers,
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.