Re: New RFC : empty() function
| From: | Brady Wetherington via internals | Date: | Tue, 31 Oct 2023 16:08:31 +0000 |
| Subject: | Re: New RFC : empty() function | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-121547@lists.php.net to get a copy of this message | ||
> I have posted a new RFC at this link
> https://wiki.php.net/rfc/empty_function
> where I suggested some improvements to the standard built-in empty()
> function and provided a number of examples.
Is your "is_empty()" function equivalent to something like:
function is_empty($param = null)
{
return empty($param) && $param !== false && $param !== 0 && $param !==
0.0;
}
If so, that might actually be kinda nice? I was looking for something
like that the other day.
Regardless, I wouldn't do the BC-break; I'd be more inclined to (very
begrudgingly) leave empty() and warn against its use, and have
is_empty() as a new thing. Maybe for some future deprecation or
removal?
I also do like the idea that someone else mentioned here about being
able to possibly start to get away from @'ing variables with a
solution like this.
-B.