I'm trying to to use preg_replace to find a string in a text and then replace it using a separate variable (array).
If it finds the text %REFERENCE>> maps% for example, it should replace it with an url to the document maps - <A HREF="maps.php">kartor</A>. I want the word "kartor" to be taken from a dictionary array.
Is this possible in the way I've done here (but with modification of cource):
$output = preg_replace("/%REFERENCE>> (.+?)%/i", "<A HREF=\"\\\\1\">".$dictionary["menu"]["\\\\1"]."</A>", $input);
??
Or does anyone have any better ideas?