WIP all_empty and any_empty#14334
WIP all_empty and any_empty#14334elminson wants to merge 2 commits intophp:masterphp/php-src:masterfrom elminson:testing_all_empty_any_emptyelminson/php-src:testing_all_empty_any_emptyCopy head branch name to clipboard
Conversation
|
You should probably go through an RFC for new user-visible features. The RFC process will help you refine the scope and implementation. |
@NattyNarwhal I will do it! thank you! |
|
In fact the implementation of this PR appears to match the PR #14108 (without giving credit), which is the PR for this RFC that is currently in voting: https://wiki.php.net/rfc/array_find Personally I do not find it useful to have extra functions specifically for working with |
|
My original branch was created on Feb 5 but never got the change to finish i, closing this PR |
My proposal involves the introduction of two new methods, any_empty and all_empty, for working with arrays. These methods are designed to provide boolean outputs indicating whether any of the elements in an array are empty, or if all elements are empty, respectively. I believe these methods will be valuable additions to PHP’s array manipulation functionalities.
Below is a brief overview of the proposed methods:
any_empty(array $array): bool - This method will return true if any element in the provided array is empty, and false otherwise.
all_empty(array $array): bool - This method will return true if all elements in the provided array are empty, and false otherwise.
These methods aim to simplify common array checks and improve code readability and efficiency.