[PHP-DEV] Re: [lists.php] Re: [PHP-DEV] Re: [lists.php] [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-30 Thread ALeX
> There are some weird questions that come up with that. For example, if an > array item is an object that implements both __invoke() and __toString(), > which should be fired? Is it a string? Or a callback? What if I pass a > literal string "strlen", is that a callback, or a replacement? You're r

Re: [PHP-DEV] Re: [lists.php] [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-30 Thread Anthony Ferrara
ALeX, On Mon, Apr 29, 2013 at 5:53 PM, ALeX wrote: > what about patch preg_replace to accept callbacks? > > example: > preg_replace(array( > "/pattern1(.*)/", > "/pattern2(.*)/" >), >array( >function ($pat) { ... } , > "replace" > ) > , ... ); > > The

Re: [PHP-DEV] Re: [lists.php] [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Laruence
On Tue, Apr 30, 2013 at 5:53 AM, ALeX wrote: > what about patch preg_replace to accept callbacks? > > example: > preg_replace(array( > "/pattern1(.*)/", > "/pattern2(.*)/" >), >array( >function ($pat) { ... } , > "replace" > ) > , ... ); > Hey: then

Re: [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Laruence
On Tue, Apr 30, 2013 at 1:43 AM, Nikita Popov wrote: > On Mon, Apr 29, 2013 at 6:46 PM, Laruence wrote: > >> Hey: >>there comes a FR: https://bugs.php.net/bug.php?id=64730 >> >>the main idea is, in 5.5 we remove support of 'e' modifier. >> >>then comes a problem, the old codes(a real

[PHP-DEV] Re: [lists.php] [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread ALeX
what about patch preg_replace to accept callbacks? example: preg_replace(array( "/pattern1(.*)/", "/pattern2(.*)/" ), array( function ($pat) { ... } , "replace" ) , ... ); -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http

Re: [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Nikita Popov
On Mon, Apr 29, 2013 at 6:46 PM, Laruence wrote: > Hey: >there comes a FR: https://bugs.php.net/bug.php?id=64730 > >the main idea is, in 5.5 we remove support of 'e' modifier. > >then comes a problem, the old codes(a real use case see > https://github.com/php/php-src/blob/PHP-5.4/Zend

Re: [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Xinchen Hui
发自我的 iPad 在 2013-4-30,1:09,Remi Collet 写道: > 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 easil

Re: [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Remi Collet
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)?

[PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-29 Thread Laruence
Hey: there comes a FR: https://bugs.php.net/bug.php?id=64730 the main idea is, in 5.5 we remove support of 'e' modifier. then comes a problem, the old codes(a real use case see https://github.com/php/php-src/blob/PHP-5.4/Zend/zend_vm_gen.php#L390): preg_replace(array( "/patt