Ive been trying make this display as html list items it just a string that i explode then loop over each item i cant get it to out put correctly. Could some one please show me where im going wrong or suggest an new approch. this is what ive tried
$path = "1/2/3/4";
$expath = explode("/",$path);
$ret = '';
echo '<ul>';
foreach ($expath as $pitem) {
echo '<li><a href='.$ret .= $pitem. "/".'>'.$pitem.'</a></li>';
}
echo '</ul>';
.
Desired out put on hrefs
1
1/2
1/2/3
1/2/3/4
Desired visual out LIs
- 1
- 2
- 3
- 4
Output i get be warned
- 1
- 1 2/>2
- 1 2/>23/>3
- 1 2/>23/>34/>4
'.$ret .= $pitem. "/".'. Wrap it with quotes, like'.$ret .'='. $pitem. "/".'.