-
Notifications
You must be signed in to change notification settings - Fork 0
/
array_siswa.php
52 lines (37 loc) · 1.23 KB
/
array_siswa.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
$ns1 = ['id' => 1, 'nim'=> '01101', 'uts'=>80, 'uas'=>84, 'tugas'=>78];
$ns2 = ['id' => 2, 'nim'=> '01121', 'uts'=>70, 'uas'=>50, 'tugas'=>68];
$ns3 = ['id' => 3, 'nim'=> '01130', 'uts'=>60, 'uas'=>86, 'tugas'=>70];
$ns4 = ['id' => 4, 'nim'=> '01134', 'uts'=>90, 'uas'=>91, 'tugas'=>82];
$ar_nilai = [$ns1, $ns2, $ns3, $ns4];
?>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<table class="table table-hover table-dark">
<table class="table" border="2" width="100%">
<thead class="thead-inverse">
<tr>
<th scope="col">#</th>
<th scope="col">NIM</th>
<th scope="col">UTS</th>
<th scope="col">UAS</th>
<th scope="col">Tugas</th>
<th scope="col">Nilai Akhir</th>
</tr>
</thead>
<?php
$nomor = 1;
foreach ($ar_nilai as $ns) {
echo '<tr><td>'.$nomor;
echo '<td>' .$ns['nim'].'</td>';
echo '<td>' .$ns['uts'].'</td>';
echo '<td>' .$ns['uas'].'</td>';
echo '<td>' .$ns['tugas'].'</td>';
$nilai_akhir = ($ns['uts'] + $ns['uas'] +$ns['tugas'])/3;
echo '<td>' .number_format($nilai_akhir,2,',','.').'</td>';
echo '<tr/>';
$nomor++;
}
?>
</tbody>
</table>