Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61286 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68460 invoked from network); 16 Jul 2012 11:23:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2012 11:23:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=florian@anderiasch.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=florian@anderiasch.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain anderiasch.de from 81.169.138.148 cause and error) X-PHP-List-Original-Sender: florian@anderiasch.de X-Host-Fingerprint: 81.169.138.148 ares.art-core.org Linux 2.5 (sometimes 2.4) (4) Received: from [81.169.138.148] ([81.169.138.148:33919] helo=mail.anderiasch.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6C/D0-63072-3C9F3005 for ; Mon, 16 Jul 2012 07:23:47 -0400 Message-ID: <5003F9BF.4010209@anderiasch.de> Date: Mon, 16 Jul 2012 13:23:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4 MIME-Version: 1.0 To: Paul Dragoonis CC: internals@lists.php.net References: <4672bc1ca5a1ad95956b60ea654f7b24@nebm.ist.utl.pt> <5003CC02.6070709@kingsquare.nl> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] New String Function: str_replace_limit From: florian@anderiasch.de (Florian Anderiasch) 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? :) Greetings, Florian