I have a variable string which is passed to an and array then foreach that just does not want to work. Below is the code im using.
$explode = $_obj->getModDependencies();
//this variable will returns/echos the string as @ModA,@Mod_b,@Mod3 etc (yes @ is in each value)
and the foreach and array php code im using
$arr = array($explode);
foreach ($arr as $value) {
echo '<a href="'.$this->getUrl().'mod?mod_id='.$value.'">'.$value.'</a>';
}
if i use the above code it echos one hyperlink with each value at the end of it (http://myurl/mod?mod_id=@ModA,@Mod_b,@Mod3) but i want to echo each hyperlink for each value.
Which would be
http://myurl/mod?mod_id=@Mod_b
and so forth.
But if i place the actual variable output string directly into the array it echos out how i want it (see below code that works)
$arr = array(@ModA,@Mod_b,@Mod3);
foreach ($arr as $value) {
echo '<a href="'.$this->getUrl().'mod?mod_id='.$value.'">'.$value.'</a>';
}
Any help wold be awesome!!