Hi, i need to help, i have a keywords field in database. There are keywords that are seperated with commas like "cat, dog, fat, dude" ı want to convert these to Tags: <a href="cat">cat</a>, <a href="dog">dog</a>, <a href="fat">fat</a>, <a href="dude">dude</a> how can i success this as a function? thanks.
thanks for your help, i want to use trim() function in the second parameter like; $string = preg_replace('/[^\,\s]+/', '<a href="$0">trim("$0")</a>', $string); PHP: But i doesnt work, what is the wrong?
With my code, there won't be any spaces in the <a> tags. Maybe there'll be spaces outside them, but they're only visible in the source code (if more than one) Is that a problem?
No, the e modifier. $string = preg_replace('/[^\,\s]+/e', '"<a href=\"$0\">" . trim("$0") ."</a>"', $string); PHP:
And sorry, I meant to say "yes, the e modifier", lol. I read your message too fast and thought you said "should I use the i modifier". Glad you got it working though.