On Sat, Apr 5, 2025, at 21:23, Bilge wrote: > On 05/04/2025 20:18, Rob Landers wrote: >> On Sat, Apr 5, 2025, at 21:10, Bilge wrote: >>> On 05/04/2025 19:41, Rob Landers wrote: >>>> empty() has very many uses. >>> That is exactly the same as saying `==` has many uses. It does. So many >>> uses that it's useless. Its semantics are nonsense. >>>> >>>> if (isset($var) && $varl != false) { >>>> foo($bool); >>>> } >>>> >>> >$varl != false >>> >>> You should never be doing this. >>> >>> Cheers, >>> Bilge >> >> Heh, to quote a great movie: That's just like, your opinion, man. In all >> seriousness, there are quite a number of uses for ==, especially because we >> don't have operators on objects, nor do we have value objects. Sometimes, >> equality isn't based on identity, but on value: >> >> https://3v4l.org/rRMNR >> >> — Rob > You don't use empty() on objects. >
I initially thought your comment was focused specifically on the use of ==, rather than "== false" or "!= false." That said, I think all of these have valid use cases, as does empty(). I'm not entirely clear on the point you're trying to make, though — if the argument is simply "you should never be doing this," it would be helpful to understand the reasoning behind that perspective. Without context or elaboration, it comes across more as a personal preference than a technical guideline. — Rob