Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61255 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87649 invoked from network); 15 Jul 2012 19:59:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2012 19:59:14 -0000 Authentication-Results: pb1.pair.com header.from=dragoonis@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dragoonis@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: dragoonis@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:55131] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/CE-20866-11123005 for ; Sun, 15 Jul 2012 15:59:14 -0400 Received: by obfk16 with SMTP id k16so9910379obf.29 for ; Sun, 15 Jul 2012 12:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ETtRABImMEqoPs7wVcxzvnbH1tcdd3eLz4620DFaAdQ=; b=QeG7g63ENrHEwYlUjmjSpPSu7AJyF/71FtCTvBHZZ7Ah/1YJs9YSVF8l49/4WmzWoR ivBn+PHaxoX393XBAN3w8C5/pqp/UP3r3MhpOCNnN6f69agOk3d0JvpQV7R9PpJbT4kG BiIvD94gCpdFGGkz7E6okM1hxDOalC++BzWaHTCNWhFXT52bWhemGLNPILCxWxwt/gLv /TAVS/ExJoYJ9mhzV0ADY5MCVjZc0ZCme6abg7BiMgwUezFuEOdbjMmejoVNclSbGMLy erdza08EoahN0Ur+2yTAnw/0jFJhCZw99xdcVC52ekFlpNHBOMr2RLKzUKHHBtN8e5d+ YfDg== MIME-Version: 1.0 Received: by 10.50.171.41 with SMTP id ar9mr3767353igc.56.1342382350712; Sun, 15 Jul 2012 12:59:10 -0700 (PDT) Received: by 10.64.32.72 with HTTP; Sun, 15 Jul 2012 12:59:10 -0700 (PDT) In-Reply-To: References: Date: Sun, 15 Jul 2012 20:59:10 +0100 Message-ID: To: Felipe Pena Cc: PHP Internals List Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] New String Function: str_replace_limit From: dragoonis@gmail.com (Paul Dragoonis) The 4th param to str_replace is a by-ref param, so you can't just skip over it, can you ? On Sun, Jul 15, 2012 at 8:54 PM, Felipe Pena wrote: > 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