Created
July 25, 2016 08:51
-
-
Save hakamibrahim/f47ddec9b8b15de6f503267ac45dbbf2 to your computer and use it in GitHub Desktop.
file kasus.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$jumlah = array(); | |
/*echo "<pre>"; | |
var_dump($kasus);*/ | |
?> | |
<h3 align="center">Data Kasus</h3> | |
<br> | |
<table class="table table-responsive"> | |
<thead> | |
<tr> | |
<?php foreach ($kasus[0] as $key => $value) { | |
$key = ltrim($key, 'a'); | |
?> | |
<th><?php echo strtoupper($key); ?></th> | |
<?php } ?> | |
</tr> | |
</thead> | |
<tbody> | |
<?php foreach ($kasus as $k) { | |
$jml_elemen = count($k); | |
$elemen = array_values($k); | |
for ($i=2; $i < $jml_elemen; $i++) { | |
$jumlah[$i] += $elemen[$i]; | |
} | |
echo "<tr>"; | |
foreach ($k as $key => $nilai) { | |
?> | |
<td><?=$nilai;?></td> | |
<?php | |
} | |
echo "</tr>"; | |
} ?> | |
</tbody> | |
<tfoot> | |
<th colspan="2" class="text-right">Jumlah</th> | |
<?php foreach ($jumlah as $key => $value) { | |
echo "<th>" . $value . "</th>"; | |
} ?> | |
</tfoot> | |
</table> | |
<br> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment