aximbigfan Posted April 16, 2008 Share Posted April 16, 2008 I have this: Array ( [0] => Array ( [CAT] => CAT [KEY] => KEY ) [1] => Array ( [CAT] => CAT1 [KEY] => KEY1 ) ) And foreach array inside of it, I want to foreach the entires so that I have a nice table, like this: +----+-----+ |CAT | KEY | +----+-----+ |CAT1|KEY1| +----+-----+ How do I do this? Thanks, Chris Quote Link to comment https://forums.phpfreaks.com/topic/101310-using-foreach-to-seperate/ Share on other sites More sharing options...
Daniel0 Posted April 16, 2008 Share Posted April 16, 2008 <?php echo '<table>'; foreach ($array as $subArray) { echo '<tr>'; foreach ($subArray as $item) { echo "<td>{$item}</td>"; } echo '</tr>'; } echo '</table>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/101310-using-foreach-to-seperate/#findComment-518211 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.