|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-11-06 17:49 UTC] et@php.net
[2013-02-17 13:18 UTC] nikic@php.net
-Status: Open
+Status: Wont fix
-Package: Feature/Change Request
+Package: *General Issues
[2013-02-17 13:18 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 19:00:01 2025 UTC |
Description: ------------ It would be nice if preg_replace_callback had a "userdata" parameter. Example: $string = "[thing 1] foo [thing 2]"; $things = array( 1 => "One thing", 2 => "Other thing"); function replace_callback($match, $data) { return $data[$match[1]]; } echo preg_replace_callback('/\[thing (\d+)\]/', 'replace_callback', $string, -1, $data); Would Output: One thing foo Other thing