Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61254 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86311 invoked from network); 15 Jul 2012 19:55:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2012 19:55:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=felipensp@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=felipensp@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) X-PHP-List-Original-Sender: felipensp@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qa0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:62486] helo=mail-qa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 49/7E-20866-52023005 for ; Sun, 15 Jul 2012 15:55:17 -0400 Received: by qafi31 with SMTP id i31so1326479qaf.8 for ; Sun, 15 Jul 2012 12:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=ZJ0aOWjF80qWl8mpAQJVmWhzsgF/I718MWvTxa3Nmfg=; b=lPSaB2CU6oyBkAQl7I3crX0840/CKDIBDmDG1IKmKgIspMuPMfRWVkh1D0RrtBoaNk tki2BtCkWADpSK+hPEaXmp9ejOgGD0QGdq/08Zaw1FVR1w7RfRWZ4ruE91QFHP359Nl8 LheLc5QfBTWLJXUO0hzTFAwzIpMA54uX7WLJXRSaA3WqT3PQ6WVYeUMCA+F0AieS4KKZ wkKVErA+MJg4bTvxCvq1nUqyZgOHI9nMJQNmBmYzkkHy4Uxeu3e8df4FexH1KlzDfHeO npCTEnzkEGgt+O5QUlDb8e/BSWOQJDXnxPZ+Ugb4h61CMqs6B/RbFp3gQz6cXYeyMEWB UnsQ== Received: by 10.224.199.201 with SMTP id et9mr16846724qab.59.1342382113840; Sun, 15 Jul 2012 12:55:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.28.129 with HTTP; Sun, 15 Jul 2012 12:54:53 -0700 (PDT) In-Reply-To: References: Date: Sun, 15 Jul 2012 16:54:53 -0300 Message-ID: To: Paul Dragoonis Cc: PHP Internals List Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] New String Function: str_replace_limit From: felipensp@gmail.com (Felipe Pena) Hi, 2012/7/15 Paul Dragoonis : > Hey, > > I'm proposing to add a new function str_replace_limit, this will be > identical to str_replace() with one key difference, you can specify > how many times you want the replace to occur. > > Currently this isn't possible with any functions in the > /ext/standard/string.c stack, the only easy workaround is using > preg_replace() which requires of course the pcre library and regex > patterns. > > I would have added this as a 4th param to str_replace(), but it > already has a 4th by-ref param to tell you how many times it done the > replacement. > > mixed str_replace_limit ( mixed $search , mixed $replace , mixed > $subject [, int $limit ] ) > > Thoughts? > Surely a 5th param is preferred. -- Regards, Felipe Pena