im trying to create a tags from array items and the number of array items is always different,
$myarray = 'sports,politics,entertainment,celebs';
$siteurl = 'http://example.com/';
$tag = explode(',', $myarray);
this is what i do
echo '<p>tag : <a href="'.$siteurl.'?'.$tag[0].'" >'.$tag[0].'</a>,
<a href="'.$siteurl.'?'.$tag[1].'" >'.$tag[1].'</a>,
<a href="'.$siteurl.'?'.$tag[2].'" >'.$tag[2].'</a>,
<a href="'.$siteurl.'?'.$tag[3].'" >'.$tag[3].'</a>,
<a href="'.$siteurl.'?'.$tag[4].'" >'.$tag[4].'</a></p>';
how can i echo this tags with a single call and get all array items no mather how much the items number?
Edit : typo for $vatag
$vatagcame?$tag = explode('<a href="' . $myarray->siteurl . '?' . $myarray->tag[1]. '" >' . $myarray->vatag[1] . '</a>', $myarray);