|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-07 11:52 UTC] nlopess@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
Description: ------------ unfortunately preg_replace_callback does not handle named groups Reproduce code: --------------- <?php $a = "bla blub blah"; $regex = '|(?P<name>blub)|'; function callback($match) { var_dump($match); return '-'; } preg_replace_callback($regex,'callback',$a); $m = array(); preg_match($regex,$a,$m); var_dump($m); ?> Expected result: ---------------- array(3) { [0]=> string(4) "blub" ["name"]=> string(4) "blub" [1]=> string(4) "blub" } array(3) { [0]=> string(4) "blub" ["name"]=> string(4) "blub" [1]=> string(4) "blub" } Actual result: -------------- array(2) { [0]=> string(4) "blub" [1]=> string(4) "blub" } array(3) { [0]=> string(4) "blub" ["name"]=> string(4) "blub" [1]=> string(4) "blub" }