Forum Moderators: coopster
Like, I want to split this text:
"This, is, a, text, with, 8, words"
What I want to do is display them like this:
<a href="page.php?id=This">This</a>, <a href="page.php?id=is">is</a>, <a href="page.php?a=this">a</a>, <a href="page.php?id=text">text</a>, <a href="page.php?id=with">with</a>, .... etc.
Dos anyone know how to make this possible?
Is there any easy way to remove the space (%20) in the link of every word
Now it looks like this:
<a href="mypage.php?id=Two%20Words">Two Words</a> <a href="mypage.php?id=%20Three%20Words%20Here">Three Words Here</a>... ect
As you see the first link is right, but the second link gets a bit screwed... Not a big problem but if anyone have a sulution to it I would appriciate it.
Thanks for all help.. :)
%[\n,]+%regular expression to
%[\n,]+\s*%, so if there's a space after the separator, it will be considered as the part of the separator itself. By the way, you could alternatively use explode [php.net] for the same task (combined with trim), if you are not familiar with regular expressions.