note 33916 deleted from function.str-replace by didou
| From: | didou@php.net | Date: | Sat, 16 Aug 2003 09:51:47 +0000 |
| Subject: | note 33916 deleted from function.str-replace by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54315@lists.php.net to get a copy of this message | ||
Note Submitter: php@forevermore.net
----
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.