Re: [RFC brainstorm] Approximately equals operator

From: Date: Tue, 01 Apr 2025 02:45:16 +0000
Subject: Re: [RFC brainstorm] Approximately equals operator
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Tue, Apr 1, 2025, 01:03 Niels Dossche <[email protected]> wrote:

> Hi internals!
>
> I'm excited to share what I've been working on!
> I had an epiphany. I realized what we truly need to revolutionize PHP: a
> new operator.
>
> Hear me out.
> We live in an imperfect world, and we often approximate data, but neither
> == nor === are ideal comparison operators to deal with these kinds of
> data.
>
> Introducing: the "approximately equal" (or "approx-equal") operator
> ~=
> (to immitate the maths symbol ≃).
> This combines the power of type coercion with approximating equality.
> Who cares if things are actually equal, close enough amirite?
>
>
Hi Niels,

When I was reading it, I felt a bit unsure, but numbers related, it was
making sense.
When you got to strings with "This is a tpyo" ~= "This is a typo",
I also
remembered today it's 1st of April, so there's that...

-- 
Alex


Thread (17 messages)

« previous php.internals (#126992) next »