This should fix your problem
$selected_publications = "<li>some data</li>";
for($ii=0; $ii <= 10; $ii++)
{
$getLi = array("<li>","</li>");
$replaceLi = array("<li><div>$ii</div><p>","</p></li>");
$selectedPublications = str_replace($getLi, $replaceLi, $selected_publications);
echo $selectedPublications;
}
another way you can do this to show the numbers of each itemization is like this
echo '<ul>';
$selected_publications = "<li style='list-style-type: none;'>some data</li>";
for($ii=0; $ii <= 10; $ii++)
{
$i=$ii;
$getLi = array("<li>","</li>");
$replaceLi = array("<li><div>$ii</div><p>","</p></li>");
$selectedPublications = str_replace($getLi, $replaceLi, $selected_publications);
echo $i.' '.$selectedPublications;
}
echo '</ul>';
ignore the html and styling it was added to look better in my eyes.
$ii <= 10 is a conditional statement, it can be changed to something like $ii > 0 which in turn will loop as many times as it needs to.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…