Edit report at https://bugs.php.net/bug.php?id=63148&edit=1
ID: 63148 Updated by: [email protected] Reported by: [email protected] Summary: Pass array key to array_filter function callback Status: Open Type: Feature/Change Request Package: Arrays related PHP Version: 5.4Git-2012-09-24 (Git) Block user comment: N Private report: N New Comment: the problem is not about consistent with other functions, the problem is do we really need this? maybe you should write to internal ML, get some more disscussion? :) thanks Previous Comments: ------------------------------------------------------------------------ [2012-09-25 03:48:08] [email protected] Also, the other functions, such as http://php.net/array_map, provide the key. ------------------------------------------------------------------------ [2012-09-25 03:07:11] [email protected] Everything that array_filter does can be done with a foreach loop though. Some people prefer the functional approach instead though. ------------------------------------------------------------------------ [2012-09-25 02:49:02] [email protected] Hey, we have various array functions, and I do believe this can be done in another ways, so, why introduce this? thanks ------------------------------------------------------------------------ [2012-09-24 09:24:29] [email protected] PR: https://github.com/php/php-src/pull/202 ------------------------------------------------------------------------ [2012-09-24 09:18:40] [email protected] Description: ------------ I would like to change array_filter to following prototype: proto array array_filter(array input [, mixed callback, bool pass_key]) The callback prototype would change to: proto bool callback(mixed value [, mixed key]) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63148&edit=1
