note 20137 added to function.preg-replace
| From: | tim at php2 dot chek dot com | Date: | Sat, 23 Mar 2002 18:33:59 +0000 |
| Subject: | note 20137 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28125@lists.php.net to get a copy of this message | ||
A simple
$rv = preg_replace("/\$$i\/", $replacement, "subject")
does not work as expected. I wanted to use it for own i18n functions to replace in Strings like
"Step $1 of $2" the appropriate positions with the appropriate function arguments.
A preg_match test makes me think that the $ sign cannot be escaped correctly. If I try a match on \$
it works but a match on \$1 does not work then the string contains $1... That works just fine in
Perl...
--
http://www.php.net/manual/en/function.preg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+20137
http://master.php.net/manage/user-notes.php?action=delete+20137
http://master.php.net/manage/user-notes.php?action=reject+20137