Re: [RFC] Binary String Comparison
| From: | Tjerk Meesters | Date: | Mon, 18 Aug 2014 15:09:02 +0000 |
| Subject: | Re: [RFC] Binary String Comparison | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76659@lists.php.net to get a copy of this message | ||
> On 18 Aug, 2014, at 10:47 pm, Johannes Schlüter <johannes@schlueters.de> wrote:
>
>> On Mon, 2014-08-18 at 14:44 +0200, Marc Bennewitz wrote:
>> The question isn't "What's wrong with ===, strcmp()?" but
>> "What's wrong
>> with ==, <, >?".
>>
>> We have a standard way to compare two operands but currently we do some
>> magic things to solve something that don't need to be solved.
>
> Still it is a key property of the language which we can't simply change.
> Also mind this: All input data are strings and some databases also
> return data as string. So code like
>
> if ($_GET['id'] > 0)
> or
> if ($db->fetchRow()[0] == 12)
>
> which is common will break.
Those two cases will actually not be affected, it's strictly string<=>string comparisons
that's being discussed here.
> Maybe using different sets of operators
> would have been better, but that should have happened 20 years ago not
> now.
>
> Also mind consistency: If you change this you probably also have to
> change other places where implicit conversion happens, i.e. array keys.
>
> In the end you get a complete new incompatible language and can throw
> away most libraries and so on.
>
> So in case you have a Tardis, DeLorean with Flux Capacitor or any other
> time machine I'm happy to support you in the past, but not this late.
>
> johannes
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>