mercredi 25 février 2015

PHP - If/Else... statement - Syntax Differences

PHP noob here. A company I do work for has an if/else statement set up like this:



{if product_type != ""} {product_type} {if:else}No Product Type{/if}


Other research I do though provides a format such as the following:



<?php if ($bodyID==='home') { ?>
<h1>I am home!</h1>
<?php } else { ?>
<p>I'm not home!</p>
<?php } ?>


Is there a specific reason for the differences in syntax, or is that just how the previous developer wrote it?


Aucun commentaire:

Enregistrer un commentaire