Two forms of PHP for circular div label echo printing is easy to understand, how to understand the second form?

< html >
< body >

<?php
    for ($i=0;$i<10;$iPP)
    {
        echo "<div></div>";
    }
?>
<hr>

    <?php for ($i=0;$i<10;$iPP){?>
        <div></div>
    <?php }?>

< / body >
< / html >

May.16,2022

one is a php file and the other is a html file. Just write the html tag directly in the php file. Insert php content in the html file with


echo I won't talk about printing. Let's talk about the second method. The
principle is that the PHP parser will only execute the code within the tag, and everything outside the tag will be output directly.

you are bad! < / div > this code is outside the tag, so it can be output directly as a string. You can directly execute it

.

test.php


<?php for ($i=0;$i<10;$iPP)

{
   ?><div></div><?php 
}

? >
can it be understood in this way?

Menu