note 21269 added to function.preg-replace-callback

From: Date: Mon, 06 May 2002 01:18:58 +0000
Subject: note 21269 added to function.preg-replace-callback
Groups: php.notes 
Request: Send a blank email to php-notes+get-30240@lists.php.net to get a copy of this message
Some times when passing $this as a reference won't work, is good to try to "global" $this in the method itself. <? preg_replace_callback(pattern, Array($this, 'method'), $str_to_replace); function method() { global $this; // Do what you want... } ?> -- http://www.php.net/manual/en/function.preg-replace-callback.php http://master.php.net/manage/user-notes.php?action=edit+21269 http://master.php.net/manage/user-notes.php?action=delete+21269 http://master.php.net/manage/user-notes.php?action=reject+21269

« previous php.notes (#30240) next »