does preg_replace_callback with class methods?

From: Date: Thu, 24 May 2001 11:26:09 +0000
Subject: does preg_replace_callback with class methods?
Groups: php.general 
Request: Send a blank email to php-general+get-54199@lists.php.net to get a copy of this message
I was using preg_replace with the '/F' parameter, and it was working perfectly till v4.0.4pl1. Now it has been substituted by preg_replace_callback. Does it work with a class method as a callback function? If it does, how should it be written? I'm asking this because in each of these cases: - preg_replace_callback(/{([A-Z_][A-Z0-9_]*)}/i', $this->callmeback, $text); - preg_replace_callback(/{([A-Z_][A-Z0-9_]*)}/i', "\$this->callmeback", $text); - preg_replace_callback(/{([A-Z_][A-Z0-9_]*)}/i', '$this->callmeback', $text); I get a warning: preg_replace_callback() requires argument 2, [...], to be a valid callback More: there is another drawback. With preg_replace + '/F' parameter I could also specify additional parameters in the command line. Now I can't. Was it really necessary to change it this way? ------------------------------------------- Gabriele Carioli Management Innovative Tools S.p.A. Piazza Falcone Borsellino n. 23 47100 Forlì (FC) - ITALY (EU) tel. 0039.0543.412941 fax. 0039.0543.412929 http://www.mit.it/

« previous php.general (#54199) next »