I would like to replace any occurance of a word from an array:
$afk[1]="ADABIP";
$afk[2]="COCSEP";
$afk[3]="ADADEC";
with a link to a relevant page like this:
The beetle ADABIP looks a lot like COCSEP except for the number of dots.
Would become:
The beetle <a href=pag.php?srt=ADABIP>ADABIP<a> looks a lot like <a href=pag.php?srt=COCSEP>COCSEP</a> except for the number of dots.
I tried:
$b=preg_replace ($afk, '<a href=pag.php?srt=$1>$1</a>', $b);
I also tried putting / / around the items in the string,
but it still does not work.
Any ideas? I admit I'm not good at this.
$afk[1]="ADABIP";
$afk[2]="COCSEP";
$afk[3]="ADADEC";
with a link to a relevant page like this:
The beetle ADABIP looks a lot like COCSEP except for the number of dots.
Would become:
The beetle <a href=pag.php?srt=ADABIP>ADABIP<a> looks a lot like <a href=pag.php?srt=COCSEP>COCSEP</a> except for the number of dots.
I tried:
$b=preg_replace ($afk, '<a href=pag.php?srt=$1>$1</a>', $b);
I also tried putting / / around the items in the string,
but it still does not work.
Any ideas? I admit I'm not good at this.