Jump to content

[SOLVED] help with preg_replace


anarchoi

Recommended Posts

hi,

 

i have this script thats supposed to make a hyperlink with every keyword separated by a " + " sign

 

$title = $eventinfo[title];

$titre = preg_replace('/('. implode('|', preg_split('/\s*\+\s*/', $title, -1, PREG_SPLIT_NO_EMPTY)) .')/', '<a href="search.php?do=process&query=$1&showposts=0&forumchoice[]=16&forumchoice[]=21&forumchoice[]=42&forumchoice[]=65"  onMouseover="showmenu(event,linkset[0])" onMouseout="delayhidemenu()">$1</a>', $title); 

 

it was working good before, but i recently changed $title's informations

 

Now it look like this :

(Country) name + of + the + event + here

 

if $title contains these informations, the script would only make links with the last 4 keywords ('of', 'the', 'event' and 'here') It seems that the parentheses are messing up the script, and the first keyword right after the parenthese is never linked

 

could anyone help me solve this problem?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/89647-solved-help-with-preg_replace/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.