Skip to content

Instantly share code, notes, and snippets.

@bdunn313
Created August 23, 2017 16:57
Show Gist options
  • Save bdunn313/8aa65c756314d6e0a9ba488d951d80df to your computer and use it in GitHub Desktop.
Save bdunn313/8aa65c756314d6e0a9ba488d951d80df to your computer and use it in GitHub Desktop.
<?php
// Normal php conditional
if (true) {
echo 'This normal one is true!';
} else {
echo 'Its false';
}
// Alternative syntax
if (true):
echo 'This alternate one is true!';
else:
echo 'Its false';
endif;
// Now to mix in some HTML
$items = ['one', 'two', 'three'];
?>
<ul>
<?php foreach($items as $i): ?>
<li><?php echo $i; ?></li>
<?php endforeach; ?>
</li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment