Req #33767 [Opn->Csd]: array_filter: support for additional callback arguments
| From: | nikic@php.net | Date: | Sun, 27 Mar 2016 20:37:50 +0000 |
| Subject: | Req #33767 [Opn->Csd]: array_filter: support for additional callback arguments | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200170@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=33767&edit=1
ID: 33767
Updated by: nikic@php.net
Reported by: tjerk dot meesters at gmail dot com
Summary: array_filter: support for additional callback
arguments
-Status: Open
+Status: Closed
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
PHP Version: 5.1.0b3
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
This is covered in a more general way by closures introduced in PHP 5.3.
Previous Comments:
------------------------------------------------------------------------
[2005-07-19 10:54:14] tjerk dot meesters at gmail dot com
Description:
------------
It would be desirable to add arguments to the callback function during the execution of
array_filter(), like so:
<?php
function filterMPEG($line,$extra)
{
return preg_match("#Codec {$extra}#",$line);
}
$a = array('Filter Low Pass','Codec MP2','Codec MP4');
// output MPEG2 codecs
print_r(array_filter($a,'filterMPEG','MP2');
// output MPEG4 codecs
print_r(array_filter($a,'filterMPEG','MP4');
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=33767&edit=1