Evan Nemerson wrote:
Basic problem:

I need to use preg_replace_callback, and would like the callback parameter to be a function in a class (the same as that which contains the call to preg_replace_callback). "classname::function" doesn't seem to work... Anyone have any ideas?

Besides create_function(), the very first comment on the preg_replace_callback() page says:


---
Also, if you want to use a *static* class method for the callback function, you can refer to it like this:
preg_replace_callback(pattern, array('ClassName', 'methodName'), subject)


In PHP5, from within the class:
  preg_replace_callback(pattern, array('self', 'methodName'), subject)
---
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to