php处理字符串并在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>";

?>
$elements = "first, second, third, fourth, fifth";
$arrayval=explode(',',$elements);
print_r($array);?>
<ul><?php
foreach($arrayval as $value){ ?>
<li><?php echo $value; ?></li>
<?php } ?>
</ul>