Return to Snippet

Revision: 46237
at May 14, 2011 07:54 by stephcode


Updated Code
if:

<?php if ($foo == 'yes') { ?>
   do something
<?php } if ($bar == 'no') { ?>
   do something else
<?php } ?>


else/if:

<?php if ($foo == 'surething') { ?>
   do this
<?php } else { ?>
   do everything else
<?php } ?>

else/if variation:

<a class="<?php if ($foo == 'righto') { ?>
   selected
<?php } else { ?>
   hoverBtn
<?php } ?>" href="contact.php"><span>Contact</span></a>

Revision: 46236
at May 14, 2011 07:53 by stephcode


Initial Code
if:

<?php if ($foo == 'yes') { ?>
   do something
<?php } if ($bar == 'no') { ?>
   do something else
<?php } ?>

else/if variation:

<a class="<?php if ($foo == 'righto') { ?>
   selected
<?php } else { ?>
   hoverBtn
<?php } ?>" href="contact.php"><span>Contact</span></a>

Initial URL

                                

Initial Description

                                

Initial Title
Basic if and else if statement with PHP

Initial Tags
php

Initial Language
PHP