发自我的 iPad

在 2013-4-30,1:09,Remi Collet <r...@fedoraproject.org> 写道:

> Le 29/04/2013 18:46, Laruence a écrit :
>
>>   so I propose to add a second argument to callback(aim to php-5.5.1),
>
> Seems a useful fix to this problem (also encounter elsewhere)
>
>>  what do you think(of course, the second argument can also easily change
>> to  be the regex idx in the regex array)?
>
> I will prefer the idx (regex can be really long and complex string, and
> a minor change to a regex need to be also applied in the callback)
Yeah, I used regex just because it is easier to make a quick patch.
Using index need more functions signature changed

Will make that patch tomorrow

Thanks
>
> Esp if you can use a more simpler / meaningful value
>
> Ex:
>
> $code = preg_replace_callback(
> array(
> "foo" => "/some very complex regex/",
> "bar" => "/another one/",
> ...
> ),
> function($matches, $idx)  {
> switch ($idx) {
>  case 'foo'
>    ...
>  case 'bar':
>    ...
> }
> },
> $code);
>
>
> My 0,02�
>
> Remi.
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to