Hi all
please help me About this qouestin :
my string for example is :
$string = "name door pic other"; //(my string is random because retrieve from DB and have Space [mysql filed = text])
I want Detachment $string in output and every Word [exam : name or other] have a link
i think i must use explode , and while for this string..
I need this output :
name door pic and....
(actually i want create news tag and every tag need a link)
use while and statement For String
Moderator: General Moderators
Re: use while and statement For String
try this...
Code: Select all
$a = "name door pic other";
$b = explode(" ", $a);
for($i=0; $i < count($b); $i++)
{
echo '<a href="#'.$b[$i].'"> '.$b[$i].' </a>';
}
Last edited by globezone on Sun Jun 14, 2009 4:53 am, edited 1 time in total.
Re: use while and statement For String
Prefect
, thank your so much