Dear friends,
I want to do this: use keywords in my links, which will be translated into numbers which in turn will be passed as variables and identify pages, ie, the actual links. I am using the following function:
function translate() {
$search = array('/keyword-sdf/','/keyword-ddsc/','/keyword-hhjfk/','/keyword-ttrhoo/','/keyword-ooffjd/','/keyword-nbnvbb/','/keyword-ssxawwe/');
$replace = array('23111','45114','88121','334122','4123','887766145','99230');
$page = preg_replace($search,$replace,"$page");
echo "page now is $page<br>";
}
It works. After the numbers are passed, I need to reconvert them to keywords and display them. Then I use the following function, which is NOT working:
function translateback() {
$searchback = array('/23111/','/45114/','/88121/','/334122/','/4123/','/887766145/','/99230/');
$replaceback = array('keyword-sdf','keyword-ddsc','keyword-hhjfk','keyword-ttrhoo','keyword-ooffjd','keyword-nbnvbb','keyword-ssxawwe');
$page = preg_replace($searchback,$replaceback,"$page");
echo "page now is $page<br>";
}
This second function is giving me an empty result. What am I doing wrong? I confess I don't know exactly what I'm doing. The manual is not clear about how that command (among so many others) works.
BTW, since I inserted those two functions in my code, the whole code began to behave a little funny. All the code is executed, the error mentioned above occurs and it looks like this is it. But it's not. More or less one minute later, PHP is run about 5 or 6 times. I know because my system is set to play a sound everytime any application is launched. WinTop (tiny process watch app) shows me it's PHP being run in a rhytmic sequence of 5 to 6 times. Nothing is sent to the browser or to the error log. Weird!
Thanks,
Luciano