mardi 8 août 2017

HTML between two separated PHP selectors contains if statement

<?php if(1 == 2){echo 1; ?>
   <div>2</div>
<?php echo 3;} ?>

In this code, I expected the div to be shown since it is just an html outside the php, but it doesn't. It works as a part of the php.

Is this a bug or it is how PHP works?

Aucun commentaire:

Enregistrer un commentaire