i ve a real problem with using preg_replace variables in a function. below is the code and working on this thing maybe decades. any help is realy realy reallyyy appr.
<?php
// this funciton does not work somehow, dunno why.
function Bela($one, $two) {
if(!isset($two)) {
$result = $one;
} else {
$result= $one.$two;
}
return $result;
}
//end of function
//givin $satir some value
$satir="(one: heuh) ve (one: sodfjsdf/4)";
// here goes the preg_replace code(i know i put some extra space omitting phases but they are not important.
$satir = preg_replace("#(( one : )(.+?)( )(\/ )([0-9])( ))#si", Bela('\2', '\5'), $satir);
// end of preg_replace code
// let the $satir be shown using echo command below
echo $satir;
?>
i cant get the function work properly with this code. all i want to do is o change the result variable if //5 is set or if it has a value.
i hope someone can solve this problem.
thx in adv.