note 54205 deleted from function.preg-replace-callback by colder

From: Date: Mon, 18 Jun 2007 18:45:22 +0000
Subject: note 54205 deleted from function.preg-replace-callback by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-127655@lists.php.net to get a copy of this message
Note Submitter: admin at the-php-tree dot com ---- Instead of using preg_replace_callback() you could use preg_replace() like below: <?php // ** Simple function: ** function my_function( $my_param_one, $my_param_two ) { // ... } preg_replace( "! \{(.+)-(.+)\} !e", "my_function('\\1', '\\2')", $input_string ); // ** Class: ** class my_class { function my_class() { preg_replace( "! \{(.+)-(.+)\} !e", "\$this->my_function('\\1', '\\2')", $input_string ); } function my_function( $my_param_one, $my_param_two ) { // ... } } ?>

« previous php.notes (#127655) next »