php - Printing dimensional array to table -
i have question array. i've got type array:
array ( [0] => array ( [0] => project [1] => time ) [1] => array ( [0] => google [1] => 29,92 ) [2] => array ( [0] => mozzila [1] => 5,96 ) [3] => array ( [0] => firefox [1] => 215,3 )
how print table:
<td style="border: 1px solid #000000; width: 50%;">'.$project.'</td> <td style="border: 1px solid #000000; width: 50%;">'.$time.'</td>
i thankful if me, solve script. because stuck. like:
project | time
google | 29,92
mozzila | 5,96
you may try this:
<table> <?php foreach($data $key => $line) { $project = $line[0]; $time = $line[1]; ?> <tr> <td style="border: 1px solid #000000; width: 50%;"><?=$project;?></td> <td style="border: 1px solid #000000; width: 50%;"><?=$time;?></td> </td> <?php } ?> </table>
Comments
Post a Comment