#20481 [NEW]: preg_replace_callback() incorrect documentation
| From: | bikeman82 at hotmail dot com | Date: | Mon, 18 Nov 2002 14:21:06 +0000 |
| Subject: | #20481 [NEW]: preg_replace_callback() incorrect documentation | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969349773@lists.php.net to get a copy of this message | ||
From: bikeman82@hotmail.com
Operating system: All
PHP version: 4.2.3
PHP Bug Type: Documentation problem
Bug description: preg_replace_callback() incorrect documentation
The documentation of preg_replace_callback() states that it is functioning
exactly like preg_replace(), except for the second argument, that should
be a 'callback'.
This is the current text:
"The behavior of this function is almost identical to preg_replace(),
except for the fact that instead of replacement parameter, one should
specify a callback that will be called and passed an array of matched
elements in the subject string. The callback should return the replacement
string. This function was added in PHP 4.0.5."
I think this is way too vague, and most of all, incorrect. Though the
functionality is similar, it is not 'almost identical'. First of all, the
callback-variant of this function is (in my release, 4.2.3) not capable of
detecting multiple patterns and passing them to multiple
callback-functions. Secondly, there is the item that is discussed in the
(English) user comments in the online version of this function, namely
that when you try to call a member function of a class from within that
class, you have to pass it an Array with as first element a reference to
$this, and then, secondly the callback-function.
Actually, I am not a very experienced php-user, and normally, I would not
post this bug, but somebody in the php.doc-newsgroup encouraged me to do
so, so this is it ...
I hope I can help the huge community I try to become a member, gets a
little improved by my first cotribution to it ...
Greetz,
Bikeman
--
Edit bug report at http://bugs.php.net/?id=20481&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20481&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20481&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20481&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20481&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20481&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20481&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20481&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20481&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20481&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20481&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20481&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20481&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20481&r=isapi