Created
October 21, 2017 04:14
-
-
Save hoksilato/b516e588e8365f309602ed710304bd65 to your computer and use it in GitHub Desktop.
Example of PHP foreach loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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