note 72517 added to function.preg-replace
| From: | congaz at yahoo dot dk | Date: | Mon, 22 Jan 2007 20:25:36 +0000 |
| Subject: | note 72517 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122041@lists.php.net to get a copy of this message | ||
If you want to use preg_replace with the e modifier in an OO-invironment, remember to escape the
dollar sign before your object-reference:
<?php
$output = preg_replace("#(pattern)#e",
"\$this->replaceMatch('$0')", $input);
?>
Although this may seem obvious for some, it escaped me (ha ha) for quite some time, going through
trial and error...
Regards,
Michael.
----
Server IP: 69.147.83.197
Probable Submitter: 86.52.23.54
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/72517
Del: integrated -- https://master.php.net/note/delete/72517/integrated
Del: useless -- https://master.php.net/note/delete/72517/useless
Del: bad code -- https://master.php.net/note/delete/72517/bad+code
Del: spam -- https://master.php.net/note/delete/72517/spam
Del: non-english -- https://master.php.net/note/delete/72517/non-english
Del: in docs -- https://master.php.net/note/delete/72517/in+docs
Del: other reasons-- https://master.php.net/note/delete/72517
Reject -- https://master.php.net/note/reject/72517
Search -- https://master.php.net/manage/user-notes.php