note 21529 rejected from function.preg-replace by torben

From: Date: Thu, 16 May 2002 01:59:51 +0000
Subject: note 21529 rejected from function.preg-replace by torben
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-30702@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?

« previous php.notes (#30702) next »