php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #6326 preg_replace does not support 'limit' argument
Submitted: 2000-08-24 00:21 UTC Modified: 2000-08-24 09:51 UTC
From: sgarner at gamezone dot co dot nz Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.0.1pl2 OS: TurboLinux Server 6.0 (kernel 2.
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sgarner at gamezone dot co dot nz
New email:
PHP Version: OS:

 

 [2000-08-24 00:21 UTC] sgarner at gamezone dot co dot nz
The documentation for preg_replace says the function supports four arguments: pattern, replacement, subject, and limit. However, PHP (4.0.1pl2) does not appear to support the last argument, limit.

Script:

<?php
   $subject = "The tiger ate plants while a tiger watched.";
   echo preg_replace("/tiger/", "giraffe", $subject, 1);
?>

Expected output:

   The giraffe ate plants while a tiger watched.

Actual output:

   Warning: Wrong parameter count for preg_replace() in dir/file.php on line 2


phpinfo() shows:

PCRE (Perl Compatible Regular Expressions) Support: enabled
PCRE Library Version: 3.1 09-Feb-2000.
Configure Command: ./configure' '--with-apache=../apache' '--with-mysql=/usr/local/mysql' '--without-gd' '--without-ttf' '--with-ftp' '--with-xml' '--with-config-file-path=/etc' '--disable-debug' '--enable-track-vars=yes'


Regards,
Simon Garner

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-24 09:03 UTC] andrei@php.net
That parameter was added after 4.0.1pl2.

 [2000-08-24 09:10 UTC] jmoore@php.net
This is not mentioned in the manual at all and should be, there is no note saying limit was added after 4.0.1pl2, Reopened and changed to docu bug
 [2000-08-24 09:51 UTC] jmoore@php.net
Had some time so did it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 18:01:35 2024 UTC