jeudi 31 décembre 2015

Explain conditional html / javascript / css / other language code with PHP if/else

I understand that the below control flow works. My question is more conceptual: How does line 2 or line 4 run as just HTML in the midst of a PHP if/else without needing any echos or other PHP syntax? And if the condition is false, how does PHP just pick up later on at the else? I guess i'm just baffled at how the code makes sense and that it actually works.

1  <?php if (condition): ?>
2  //html code to run if condition is true
3  <?php else: ?>
4  //html code to run if condition is false
5  <?php endif ?>

Aucun commentaire:

Enregistrer un commentaire