PHP 4.0 Bug #6326: preg_replace does not support 'limit' argument

From: Date: Thu, 24 Aug 2000 04:21:13 +0000
Subject: PHP 4.0 Bug #6326: preg_replace does not support 'limit' argument
Groups: php.dev 
Request: Send a blank email to php-dev+get-30467@lists.php.net to get a copy of this message
From: sgarner@gamezone.co.nz Operating system: TurboLinux Server 6.0 (kernel 2.2.14) PHP version: 4.0.1pl2 PHP Bug Type: Misbehaving function Bug description: preg_replace does not support 'limit' argument 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

« previous php.dev (#30467) next »