as you can see im doing a loop as below. There are 2 data set involved:
$transaction_list_pending; $transaction_list_completed; <?php foreach($transaction_list_pending as $transaction) { ?> <div id="P<?php echo $transaction->trans_id; ?>" class="modal fade" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered transaction-details" role="document"> <div class="modal-content"> some content </div> </div> </div> <?php } ?>
How do i restart this same loop by using $transaction_list_completed
as the variable in the foreach statement?
Suggestion to copy the loop is not what im looking for (maybe if no other solution) as the html content for this Modal consists of hundreds of code line.
Advertisement
Answer
You could merge the arrays:
<?php foreach(array_merge($transaction_list_pending, $transaction_list_completed) as $transaction) { ?> <!-- your HTML --> <?php } ?>