so i have got this string:
<?php
$elements = "first, second, third, fourth, fifth";
?>
And i'd like it to be echoed out like this:
<ul>
<li>first</li>
<li>second</li>
<li>third</li>
<li>fourth</li>
<li>fifth</li>
</ul>
so i have got this string:
<?php
$elements = "first, second, third, fourth, fifth";
?>
And i'd like it to be echoed out like this:
<ul>
<li>first</li>
<li>second</li>
<li>third</li>
<li>fourth</li>
<li>fifth</li>
</ul>
Try this, it may help you issue;
<?php
$elements = "first, second, third, fourth, fifth";
$numbers = explode(", ", $elements);
echo "<ul>";
foreach ($numbers as $number) {
echo "<li>{$number}</li>";
}
echo "</ul>";
?>