I have a function like below
function addMinus($string){
$output = str_replace("%20", "-", $string);
$output = str_replace(" ", "-", $output);
return $output;
}
I need to use function that given above in the following function
function addgsk($string){
$regex = '~\(gsk:(.*?)\)~six';
$link = "$1";
$link = addMinus($link);
$output = preg_replace($regex, "<a href='$link'>(gsk:$1)</a>", $string);
return $output;
}
But my problem is that $link = addMinus($link);
do not work. The spaces do not replaced by "-". I think it is because of the data from regex.
Note: I do not get any error but the function (addMinus) do not work.