Numbered list

I have a task. Please help, I will be very grateful
Here’s my code, I tried…

<?php

    echo "<hr>";

    echo "<ol>";

    for ($i = 1; $i <= 10; $i++)

    {

        if ($i % 2 == 0)

        {

            echo "<li>Macbook</li>";

           

        }

        if ($i % 2 == 0)

        {

           

            echo "<li> Apple </li>";

       

        }

        else

        {

            echo "<li>Laptop</li>";

        }

    };

    echo "</ol>";

?>

First of all what are you trying to do?
Second you code makes no sense as it’s doing the same thing no matter what the condition is.

Would it not make more sense to use a numbered list?

Sponsor our Newsletter | Privacy Policy | Terms of Service