php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33767 array_filter: support for additional callback arguments
Submitted: 2005-07-19 10:54 UTC Modified: 2016-03-27 20:37 UTC
Votes:9
Avg. Score:3.6 ± 1.6
Reproduced:7 of 8 (87.5%)
Same Version:1 (14.3%)
Same OS:1 (14.3%)
From: tjerk dot meesters at gmail dot com Assigned: nikic (profile)
Status: Closed Package: *General Issues
PHP Version: 5.1.0b3 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tjerk dot meesters at gmail dot com
New email:
PHP Version: OS:

 

 [2005-07-19 10:54 UTC] 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');

?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-27 20:37 UTC] nikic@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: nikic
 [2016-03-27 20:37 UTC] nikic@php.net
This is covered in a more general way by closures introduced in PHP 5.3.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC