php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69189 Passing multiple callbacks to preg_replace_callback.
Submitted: 2015-03-04 22:47 UTC Modified: 2015-03-21 21:00 UTC
From: admin at azareal dot com Assigned: nikic (profile)
Status: Closed Package: PCRE related
PHP Version: master-Git-2015-03-04 (Git) OS: Any
Private report: No CVE-ID: None
 [2015-03-04 22:47 UTC] admin at azareal dot com
Description:
------------
It would be nice, if it was possible to pass multiple callbacks to preg_replace_callback instead of just one. One possible method might be by placing them in an array.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-04 23:20 UTC] php at requinix dot net
But how would that work? The first callback takes an array of matches as an argument, returns a string for the replacement, then the second does... what?
Maybe you have an example in mind?
 [2015-03-05 04:52 UTC] laruence@php.net
actually, I proposed something like that.. but it was declined

need looking for it in ML :<
 [2015-03-05 15:15 UTC] reeze@php.net
no matter whatever you want you could wrapper them in the single callable.
 [2015-03-21 21:00 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2015-03-21 21:00 UTC] nikic@php.net
Implemented now as described in the linked RFC.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 26 12:03:35 2021 UTC