Posted by Marc Bauer on 10/11/07 22:48
Hi
i have an preg_replace_callback that matches some strings and i'd like to
execute a sub function with two params. Only thing i need is to call the
subfunction 'my_function' with the $matches and an addition $param. How can
i add the second param to the preg_replace_callback line?
function test_function($demo) {
$example = "Some data";
$test = preg_replace_callback('my example regexp', 'my_function',
$example);
}
function my_function($matches, $param = 0) {
//do some stuff here
if ($param) {
// do something special
}
}
Regards
Marc
Navigation:
[Reply to this message]
|