note 33916 added to function.str-replace
| From: | php at forevermore dot net | Date: | Fri, 11 Jul 2003 00:16:42 +0000 |
| Subject: | note 33916 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51872@lists.php.net to get a copy of this message | ||
Be aware that when using the "e" option, php escapes any quotes in your sequence. This is
a problem when you want to directly use the text you match as parameters in the function you wish to
execute:
$str = "params='word', 99, 'word'";
$str = preg_replace('/params=(.+)$/', 'my_func($1);', $str);
This does NOT work, since php sees the execution statement as:
my_func(\'word\', 99, \'word\');
this obviously generates an error because of the escaped quotes.
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33916
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33916&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33916&report=yes