Print Friendly and PDF
How to print Ul Li break it every 7 elements by using for loop in PHP.
How to print Ul Li break it every 7 elements by using for loop in PHP.In this tutorial taking 100 elements and print it all number.

Php Code 

<!DOCTYPE html>

<head>

<title>Simple Program</title>
</head>
<body>
<?php
$j=1;
echo "<ul>";
for($i=1;$i<=100;$i++){
    echo "<li>";
    echo "$i";
    echo "</li>";
    if($j % 7 == 0)
 {
  
 echo "</ul>";
 echo "<ul>";
 }
  $j++;
}
echo "</ul>";

?>

</body>
</html>
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: