Hi!
> Here is another example from a real case (Horde_Date)
Looks like the case of doing it wrong. In most cases it doesn't even
need regexp, in others, generic regexp with post-parsing would probably
be more efficient as this seems to do 20+ passes through the string.
--
Stanislav Malyshev, S
Le 04/05/2013 14:39, Laruence a écrit :
>with this patch, preg_replace_callback will call user callback with two
> arguments, the first one is the same, the second is the regex key if the
> regex is an array or NULL if the regex is a string.
Here is another example from a real case (Horde_
On Sat, May 4, 2013 at 4:31 PM, Laruence wrote:
> I made a RFC for this:
> https://wiki.php.net/rfc/second_arg_to_preg_callback
>
>
Note that giving meaning to an extra argument in existing callbacks
constitutes a small BC break in at least two cases:
1)
function myhandyfunction($v, $arg = 42)
On 05/04/2013 08:28 AM, Laruence wrote:
> and inefficent not always means performance only, in this case , you
> need to define various functions for different regexs if you use loop style.
>
> and do you prefer array_walk or foreach when you try to iteraterly
> process an array?
I certainly
I made a RFC for this: https://wiki.php.net/rfc/second_arg_to_preg_callback
thanks
On Sat, May 4, 2013 at 10:28 PM, Laruence wrote:
>
>
>
> On Sat, May 4, 2013 at 9:46 PM, Anthony Ferrara wrote:
>
>> Laruence,
>>
>> > foreach ($replacements as $regex => $callback) {
>> > > $str = preg_re
On Sat, May 4, 2013 at 9:46 PM, Anthony Ferrara wrote:
> Laruence,
>
> > foreach ($replacements as $regex => $callback) {
> > > $str = preg_replace_callback($regex, $callback, $str);
> > > }
> > >
> >
> > So if there are 10 regex in the array, you will got 10 DO_FCALL. 10
> times
> > argumen
Laruence,
> foreach ($replacements as $regex => $callback) {
> > $str = preg_replace_callback($regex, $callback, $str);
> > }
> >
>
> So if there are 10 regex in the array, you will got 10 DO_FCALL. 10 times
> arguments accept, 10 times etc...
>
> and AS I already said: IT is inefficient. I
On Sat, May 4, 2013 at 8:58 PM, Nikita Popov wrote:
> On Sat, May 4, 2013 at 2:52 PM, Laruence wrote:
>
>>
>>
>>
>> On Sat, May 4, 2013 at 8:49 PM, Nikita Popov wrote:
>>
>>> On Sat, May 4, 2013 at 2:39 PM, Laruence wrote:
>>>
Hey:
Sorry for the delay, the new patch, which make th
On Sat, May 4, 2013 at 2:52 PM, Laruence wrote:
>
>
>
> On Sat, May 4, 2013 at 8:49 PM, Nikita Popov wrote:
>
>> On Sat, May 4, 2013 at 2:39 PM, Laruence wrote:
>>
>>> Hey:
>>>Sorry for the delay, the new patch, which make the second argument
>>> the
>>> regex array keys is attached.
>>>
>
On Sat, May 4, 2013 at 8:49 PM, Nikita Popov wrote:
> On Sat, May 4, 2013 at 2:39 PM, Laruence wrote:
>
>> Hey:
>>Sorry for the delay, the new patch, which make the second argument the
>> regex array keys is attached.
>>
>>
>>
>> https://bugs.php.net/patch-display.php?bug_id=64730&patch=sec
On Sat, May 4, 2013 at 8:49 PM, Nikita Popov wrote:
> On Sat, May 4, 2013 at 2:39 PM, Laruence wrote:
>
>> Hey:
>>Sorry for the delay, the new patch, which make the second argument the
>> regex array keys is attached.
>>
>>
>>
>> https://bugs.php.net/patch-display.php?bug_id=64730&patch=sec
On Sat, May 4, 2013 at 2:39 PM, Laruence wrote:
> Hey:
>Sorry for the delay, the new patch, which make the second argument the
> regex array keys is attached.
>
>
>
> https://bugs.php.net/patch-display.php?bug_id=64730&patch=second_arg_rege_key.patch&revision=latest
>
>with this patch,
Hey:
Sorry for the delay, the new patch, which make the second argument the
regex array keys is attached.
https://bugs.php.net/patch-display.php?bug_id=64730&patch=second_arg_rege_key.patch&revision=latest
with this patch, preg_replace_callback will call user callback with two
arguments,
13 matches
Mail list logo