You are here: Execute function in preg_replace_callback with matches and an extra param? « PHP Language « IT news, forums, messages
Execute function in preg_replace_callback with matches and an extra param?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация