lilmer Posted February 26, 2013 Share Posted February 26, 2013 I've been playing for this and I really can't figure how to count the sub array and post a value: Array ( [1] => Array ( [A] => Hello [b] => [C] => Hello [D] => ) [2] => Array ( [A] => [b] => world! [C] => [D] => world! ) [3] => Array ( [A] => [b] => [C] => [D] => ) [4] => Array ( [A] => Miscellaneous [b] => [C] => [D] => ) [5] => Array ( [A] => List [b] => bump [C] => [D] => ) ) So what I want to happen is: <table> <tbody> <tr> <td>Hello</td><td>B</td><td>Hello</td><td>D</td> </tr> <tr> <td></td><td>world!</td><td></td><td>world!</td> </tr> <tr> <td>A</td><td>B</td><td>C</td><td>D</td> </tr> <tr> <td>A</td><td>B</td><td>C</td><td>D</td> </tr> <tr> <td>A</td><td>B</td><td>C</td><td>D</td> </tr> </tbody> </table> I already count the main array, but I can't get the sub array and post them on a table data w/ each specific value. Quote Link to comment https://forums.phpfreaks.com/topic/274955-count-sub-array-inside-an-array-and-post/ Share on other sites More sharing options...
lilmer Posted February 26, 2013 Author Share Posted February 26, 2013 (edited) I get it again. $count = count($sheetData); echo "<table><tbody>"; foreach($sheetData as $a => $k){ echo "<tr>"; $co = count($k); foreach ($k as $j => $value) { echo "<td>$value</td>"; } echo "</tr>"; } echo "<tbody></table>"; Jess rate $100/hour Edited February 26, 2013 by lilmer Quote Link to comment https://forums.phpfreaks.com/topic/274955-count-sub-array-inside-an-array-and-post/#findComment-1415057 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.