> var_dump(random_int(1, 1) ~= 1.1); // true This one cracked me :D Thanks Niels!
On Tue, Apr 1, 2025 at 5:48 AM Alexandru Pătrănescu <dreal...@gmail.com> wrote: > > > On Tue, Apr 1, 2025, 01:03 Niels Dossche <dossche.ni...@gmail.com> 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 > -- Iliya Miroslavov Iliev i.mirosla...@gmail.com