function Matcher () { print "matched"; } function NewsFilter ($contents) { $newcontents = preg_replace_callback ("/Q\(([A-Z]+)\)/", array($this,"Matcher"), "\1", $contents); print $newcontents; exit; }