Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61253 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84815 invoked from network); 15 Jul 2012 19:45:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2012 19:45:20 -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:33472] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/2E-20866-FCD13005 for ; Sun, 15 Jul 2012 15:45:20 -0400 Received: by obfk16 with SMTP id k16so9892827obf.29 for ; Sun, 15 Jul 2012 12:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=GGt/EFab+wM4sWI05x+lwEuBiD7WefT2IZSSvbaEgT8=; b=ANx5GPUEWs1dSjjCbqJjb3Zws943WxLy1gOXFGJLMjsGuxpr4yozstt3wFbcgiZWim 57MclNW7C7Ew1qbytWPqHXu92t5Xb21cr7Ge4Zln2E9J5UlZo9aIrlw3NuseF1BBoKE1 zONVEPSwA1dnX8lWs/UHB4JDEZOS4XsAwkC4K4cOmGi25gamskyr+URFmCRqWbC6xLy6 R1fjzVLtFDFSg/3YvLl5mzNcnZZufS8iMTa+w5bpTyDEDe9HRp+ZoYbfg7k0LjxencwG 0c8UQVcWbfnZbpVCLcq4G/6JB6de5NwaDwFUEb9hB4eE/KXT295q3skNpQe8wgg8U6YT tKIw== MIME-Version: 1.0 Received: by 10.50.160.202 with SMTP id xm10mr3805760igb.10.1342381516178; Sun, 15 Jul 2012 12:45:16 -0700 (PDT) Received: by 10.64.32.72 with HTTP; Sun, 15 Jul 2012 12:45:16 -0700 (PDT) Date: Sun, 15 Jul 2012 20:45:16 +0100 Message-ID: To: PHP Internals List Content-Type: text/plain; charset=ISO-8859-1 Subject: New String Function: str_replace_limit From: dragoonis@gmail.com (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? Paul Dragoonis.