Re: PR 287 - added use_keys argument to array_filter() [Discussion]
| From: | Andrea Faulds | Date: | Thu, 26 Sep 2013 16:31:02 +0000 |
| Subject: | Re: PR 287 - added use_keys argument to array_filter() [Discussion] | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-69356@lists.php.net to get a copy of this message | ||
On 26/09/2013 05:42, Tjerk Meesters wrote:
Hi, I've updated my patch to allow a range of values to be passed as the third argument: pass key, pass value or pass both. Instead of using OR-able constants, I went with an enumeration type because there are only going to be three options; it just felt wrong to haveI suggest the following change: ext/standard/php_array.h:119:ARRAY_FILTER_USE_KEY | ARRAY_FILTER_USE_VALUEinstead of a simplerARRAY_FILTER_USE_BOTHor even justtrue.
#define ARRAY_FILTER_USE_BOTH 1 #define ARRAY_FILTER_USE_KEY 2 #define ARRAY_FILTER_USE_VALUE 3becomes: ext/standard/php_array.h:119:
#define ARRAY_FILTER_USE_KEY 1 #define ARRAY_FILTER_USE_VALUE 2 #define ARRAY_FILTER_USE_BOTH 3Such that we have the best of both worlds, either
ARRAY_FILTER_USE_BOTH or `ARRAY_FILTER_USE_KEY | ARRAY_FILTER_USE_VALUE` :D
--
Andrea Faulds
http://ajf.me/