[PHP-DEV] Bug #11085 Updated: preg_replace_callback and class methods
ID: 11085 Updated by: mfischer Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Closed Bug Type: PCRE related Operating system: PHP Version: 4.0.5 Assigned To: Comments: Method callbacks are performed with the syntax array( $object, 'method'); in your case you want to write preg_replace_callback( '/{([A-Z_][A-Z0-9_]*)}/i', array( $this, 'callmeback');, $text); Btw, you missed the ' after callback( ... - Markus Previous Comments: --- [2001-05-24 08:38:35] [EMAIL PROTECTED] 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 preg_replace_callback work with class method as a callback function, too? 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. --- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=11085edit=2 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #11085 Updated: preg_replace_callback and class methods
ID: 11085 Updated by: mfischer Reported By: [EMAIL PROTECTED] Status: Closed Bug Type: PCRE related Operating system: PHP Version: 4.0.5 Assigned To: Comments: Forget the ';' after 'callmeback') ... - Markus Previous Comments: --- [2001-05-24 09:25:03] [EMAIL PROTECTED] Method callbacks are performed with the syntax array( $object, 'method'); in your case you want to write preg_replace_callback( '/{([A-Z_][A-Z0-9_]*)}/i', array( $this, 'callmeback');, $text); Btw, you missed the ' after callback( ... - Markus --- [2001-05-24 08:38:35] [EMAIL PROTECTED] 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 preg_replace_callback work with class method as a callback function, too? 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. --- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=11085edit=2 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]