Re: New String Function: str_replace_limit

From: Date: Mon, 16 Jul 2012 11:30:39 +0000
Subject: Re: New String Function: str_replace_limit
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-61287@lists.php.net to get a copy of this message
On Mon, Jul 16, 2012 at 12:23 PM, Florian Anderiasch <florian@anderiasch.de> wrote: > On 07/16/2012 10:29 AM, Paul Dragoonis wrote: >> Thanks for the comments guys, I like your idea about skipping the >> by-ref count parameter. >> >> If the 'default' keyword were to be added in, then you could skip the >> 4th parameter and add your 5th 'limit' option. >> >> $str = str_replace($search, $replace, $subject, default, 5); >> >> Does anyone have any objections on this implementation approach? >> (obviously we'd have to wait for the default param skipping to be >> implemented, I'm not sure on the implementation status of that >> feature) > > I'm not seeing what's the problem with it being a by-ref variable, as > you've mentioned it twice now. Are you bothered by an additional > variable being set in memory when skipping (i.e. not using it)? Or am I > reading more into it than you tried to say? :) I believe you were reading more into it. I mention by-ref so it's easy to know if i'm talking about the existing or new proposed param. I'm not bothered by the by-ref param being skipped over to get to the 5th one, it's a hit I'm willing to take to achieve necessary functionality on str_replace(). If nobody has any further concerns I'll go ahead and create this new parameter and provide a PR on github accordingly. Paul Dragoonis. > > Greetings, > Florian

« previous php.internals (#61287) next »