note 21529 added to function.preg-replace
| From: | sal at stodge dot org | Date: | Thu, 16 May 2002 01:43:55 +0000 |
| Subject: | note 21529 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30700@lists.php.net to get a copy of this message | ||
But what if you want to call a method of the current class through the /e option?
$whatever=preg_replace( $pattern,"$this->cb_substitute('\\1')", $value );
... does not seem to work. I think this is because the PHP snippet in brackets is executed outside
of the context of the class. The only functions that can appear between those brackets are built-ins
or global functions.
The only workaround I can think of is building an external global function that in-turn calls back a
method of the original object... there has to be a better way. Anybody?
--
http://www.php.net/manual/en/function.preg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+21529
http://master.php.net/manage/user-notes.php?action=delete+21529
http://master.php.net/manage/user-notes.php?action=reject+21529