$groups = array("Group1"=>array("V1"=>array(1,2,3,4,5),
"V2"=>array(2,3,4,5,6),
"V3"=>array(3,4,5,6,7)
),
"Group2"=>array("V1"=>array(11,22,33,44,55),
"V2"=>array(11,21,31,41,51),
"V3"=>array(12,23,34,45,56)
),
"Group3"=>array("V1"=>array(1,2,3,4,5),
"V2"=>array(1,2,3,4,5),
"V3"=>array(1,2,3,4,5)
),
"Group4"=>array("V1"=>array(1,2,3,4,5),
"V2"=>array(1,2,3,4,5),
"V3"=>array(1,2,3,4,5)
),
"Group5"=>array("V1"=>array(1,2,3,4,5),
"V2"=>array(1,2,3,4,5),
"V3"=>array(1,2,3,4,5)
)
);
Я хочу отобразить из этого массива в HTML-таблицу нечто подобное
Group1 | Group2
h1|h2|h3|h4|h5 | h1|h2|h3|h4|h5
V1 value of its value of its
V2 value of its value of its
V3
Group3 | Group4
h1|h2|h3|h4|h5 | h1|h2|h3|h4|h5
V1 value of its value of its
V2 value of its value of its
V3 value of its value of its
Group5 |
h1|h2|h3|h4|h5 |
V1 value of its
V2 value of its
V3 value of its
Я пытаюсь сделать так:
$g_list = array_keys($groups);
echo '<table border=1>';
for($g=0;$g<=sizeOf($groups);$g++){
if(($g+1)<sizeOf($groups)){
echo "<tr>
<td COLSPAN=6 ALIGN=center>".$g_list[$g]."</td>
<td COLSPAN=6 ALIGN=center>".$g_list[$g+1]."</td></tr>";
echo "<tr>
<td> </td><td>h1</td><td>h2</td><td>h3</td><td>h4</td><td>h5</td>
<td> </td><td>h1</td><td>h2</td><td>h3</td><td>h4</td><td>h5</td>
</tr>";
echo "<tr>
<td>V</td>
</tr>";
//todo
}
}
Я не смог найтиэто из?Кто-нибудь может мне помочь в php?