Skip to content

Instantly share code, notes, and snippets.

@hoksilato
Created October 21, 2017 04:14
Show Gist options
  • Save hoksilato/b516e588e8365f309602ed710304bd65 to your computer and use it in GitHub Desktop.
Save hoksilato/b516e588e8365f309602ed710304bd65 to your computer and use it in GitHub Desktop.
Example of PHP foreach loop
<?php foreach ($faqs as $i => $faq) { ?>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading<?php echo $i; ?>">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse<?php echo $i; ?>" aria-expanded="false" aria-controls="collapse<?php echo $i; ?>">
<?php echo $faq['question']; ?>
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<?php echo $i; ?>">
<div class="panel-body">
<?php echo $faq['answer']; ?>
</div>
</div>
</div>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment