Tugas !
1. Buatlah program untuk fungsi string dalam array untuk menampilkan 2 buah datadari data “Manajemen” dan informatika.
Langkah-langkah untuk membuat programnya disini dengan menggunakan Notepad
1.Ketikan script dibawah ini
<html>
<head>
<title>Modul 8 | Praktik 5</title>
<link href='/style.css' rel='stylesheet' type='text/css'/>
<script src='/script.js' type='text/javascript'></script>
</head>
<body onload="document.body.style.backgroundColor=bg">
<div id="judul">Tugas Praktik (14)</div>
<div id="isi">
<div id="tengah">
<?php
echo "<table style=float:left width=49% border=1 cellpadding=5 cellspacing=0 align=center><tr><th>Fungsi</th><th>Hasil</th></tr>";
$data = array ("m","a","n","a","j","e","m","e","n");
echo "<tr><td>\$data</td><td>";
for ($a=0;$a<count($data);$a++) {
echo "$data[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,3)</td><td>";
$hasil = array_slice($data,3);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,4,-2)</td><td>";
$hasil = array_slice($data,4,-2);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,4)</td><td>";
$hasil = array_slice($data,4);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,2,-2)</td><td>";
$hasil = array_slice($data,2,-2);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr></table>";
echo "<table style=float:right width=49% border=1 cellpadding=5 cellspacing=0 align=center><tr><th>Fungsi</th><th>Hasil</th></tr>";
$data = array ("i","n","f","o","r","m","a","t","i","k","a");
echo "<tr><td>\$data</td><td>";
for ($a=0;$a<count($data);$a++) {
echo "$data[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,5)</td><td>";
$hasil = array_slice($data,5);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,1,-4)</td><td>";
$hasil = array_slice($data,1,-4);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,2)</td><td>";
$hasil = array_slice($data,2);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,3,-1)</td><td>";
$hasil = array_slice($data,3,-1);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr></table>";
?>
</div>
</div>
</body>
</html>
2. Simpan dengan nama “praktik_1” di document-root komputer.<head>
<title>Modul 8 | Praktik 5</title>
<link href='/style.css' rel='stylesheet' type='text/css'/>
<script src='/script.js' type='text/javascript'></script>
</head>
<body onload="document.body.style.backgroundColor=bg">
<div id="judul">Tugas Praktik (14)</div>
<div id="isi">
<div id="tengah">
<?php
echo "<table style=float:left width=49% border=1 cellpadding=5 cellspacing=0 align=center><tr><th>Fungsi</th><th>Hasil</th></tr>";
$data = array ("m","a","n","a","j","e","m","e","n");
echo "<tr><td>\$data</td><td>";
for ($a=0;$a<count($data);$a++) {
echo "$data[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,3)</td><td>";
$hasil = array_slice($data,3);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,4,-2)</td><td>";
$hasil = array_slice($data,4,-2);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,4)</td><td>";
$hasil = array_slice($data,4);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,2,-2)</td><td>";
$hasil = array_slice($data,2,-2);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr></table>";
echo "<table style=float:right width=49% border=1 cellpadding=5 cellspacing=0 align=center><tr><th>Fungsi</th><th>Hasil</th></tr>";
$data = array ("i","n","f","o","r","m","a","t","i","k","a");
echo "<tr><td>\$data</td><td>";
for ($a=0;$a<count($data);$a++) {
echo "$data[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,5)</td><td>";
$hasil = array_slice($data,5);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,1,-4)</td><td>";
$hasil = array_slice($data,1,-4);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,2)</td><td>";
$hasil = array_slice($data,2);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr><tr><td>array_slice(\$data,3,-1)</td><td>";
$hasil = array_slice($data,3,-1);
for ($a=0;$a<count($hasil);$a++) {
echo "$hasil[$a]";
}
echo "</td></tr></table>";
?>
</div>
</div>
</body>
</html>
3. Buka browser dan ketikkan alamat http://localhost/yani/praktik_1.php
4. Lihat hasilnya di browser. Akan terlihat tampilan seperti pada gambar dibawah ini.
2. Buatlah program untuk menghitung matrik 2 x 2
Langkah-langkah untuk membuat programnya disini dengan menggunakan Notepad.
1.Ketikan script dibawah ini
<
<html>
<head>
<title>Modul 8 | Praktik 2</title>
<link href='/style.css' rel='stylesheet' type='text/css'/>
<script src='/script.js' type='text/javascript'></script>
</head>
<body onload="document.body.style.backgroundColor=bg">
<div id="judul">Tugas Praktik (15)</div>
<div id="isi">
<div id="tengah">
<?php
echo "<div style=width:40%;margin:auto>Matriks</div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=width:40%;margin:auto><table style=float:left;margin-top:20px; width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td rowspan=2 valign=center>A</td><td>=</td></tr></table>";
echo "<table style=float:left width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$A = array (3,2,4,9);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$A[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$A[$j]."</td>";
}
echo "</tr>";
echo "</table>";
echo "<table style=float:right; width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$B = array (5,6,2,0);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$B[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$B[$j]."</td>";
}
echo "</tr>";
echo "</table><table style=float:right;margin-top:20px;margin-left:20px; width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td rowspan=2 valign=center>B</td><td>=</td></tr></table></div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=width:40%;margin:auto>Perhitungan Matriks</div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=width:40%;margin:auto><table style=float:left;margin-top:20px; width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td>A</td><td>+</td><td>B</td><td>=</td></tr></table>";
echo "<table style=float:left width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$penjumlahan = array ($A[0]+$B[0],$A[1]+$B[2],$A[2]+$B[1],$A[3]+$B[3]);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$penjumlahan[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$penjumlahan[$j]."</td>";
}
echo "</tr>";
echo "</table>";
echo "<div style=clear:both;padding-top:20px;></div>"; echo "<table style=float:right width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$perkalian = array ($A[0]*$B[0],$A[1]*$B[2],$A[2]*$B[1],$A[3]*$B[3]);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$perkalian[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$perkalian[$j]."</td>";
}
echo "</tr>";
echo "</table><table style=float:right;margin-top:20px;margin-left:20px width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td>A</td><td>x</td><td>B</td><td>=</td></tr></table></div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=width:40%;margin:auto><table style=float:left;margin-top:20px; width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td>A</td><td>-</td><td>B</td><td>=</td></tr></table>";
echo "<table style=float:left width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$pengurangan = array ($A[0]-$B[0],$A[1]-$B[2],$A[2]-$B[1],$A[3]-$B[3]);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$pengurangan[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$pengurangan[$j]."</td>";
}
echo "</tr>";
echo "</table>";
?>
</div>
</div>
</body>
</html>
2. Simpan dengan nama “praktik_1” di document-root komputer. <head>
<title>Modul 8 | Praktik 2</title>
<link href='/style.css' rel='stylesheet' type='text/css'/>
<script src='/script.js' type='text/javascript'></script>
</head>
<body onload="document.body.style.backgroundColor=bg">
<div id="judul">Tugas Praktik (15)</div>
<div id="isi">
<div id="tengah">
<?php
echo "<div style=width:40%;margin:auto>Matriks</div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=width:40%;margin:auto><table style=float:left;margin-top:20px; width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td rowspan=2 valign=center>A</td><td>=</td></tr></table>";
echo "<table style=float:left width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$A = array (3,2,4,9);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$A[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$A[$j]."</td>";
}
echo "</tr>";
echo "</table>";
echo "<table style=float:right; width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$B = array (5,6,2,0);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$B[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$B[$j]."</td>";
}
echo "</tr>";
echo "</table><table style=float:right;margin-top:20px;margin-left:20px; width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td rowspan=2 valign=center>B</td><td>=</td></tr></table></div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=width:40%;margin:auto>Perhitungan Matriks</div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=width:40%;margin:auto><table style=float:left;margin-top:20px; width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td>A</td><td>+</td><td>B</td><td>=</td></tr></table>";
echo "<table style=float:left width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$penjumlahan = array ($A[0]+$B[0],$A[1]+$B[2],$A[2]+$B[1],$A[3]+$B[3]);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$penjumlahan[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$penjumlahan[$j]."</td>";
}
echo "</tr>";
echo "</table>";
echo "<div style=clear:both;padding-top:20px;></div>"; echo "<table style=float:right width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$perkalian = array ($A[0]*$B[0],$A[1]*$B[2],$A[2]*$B[1],$A[3]*$B[3]);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$perkalian[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$perkalian[$j]."</td>";
}
echo "</tr>";
echo "</table><table style=float:right;margin-top:20px;margin-left:20px width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td>A</td><td>x</td><td>B</td><td>=</td></tr></table></div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=clear:both;padding-top:20px;></div>";
echo "<div style=width:40%;margin:auto><table style=float:left;margin-top:20px; width=5% border=0 cellpadding=5 cellspacing=0 align=center><tr><td>A</td><td>-</td><td>B</td><td>=</td></tr></table>";
echo "<table style=float:left width=100px border=1 cellpadding=5 cellspacing=0 align=center>";
$pengurangan = array ($A[0]-$B[0],$A[1]-$B[2],$A[2]-$B[1],$A[3]-$B[3]);
echo "<tr>";
for ($i=0;$i<2;$i++) {
echo "<td align=center width=50%>".$pengurangan[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for ($j=2;$j<4;$j++) {
echo "<td align=center width=50%>".$pengurangan[$j]."</td>";
}
echo "</tr>";
echo "</table>";
?>
</div>
</div>
</body>
</html>
3. Buka browser dan ketikkan alamat http://localhost/yani/praktik_2.php
4. Lihat hasilnya di browser. Akan terlihat tampilan seperti pada gambar dibawah ini.
5.Selesai
3. Buatlah program untuk mendeklarasikan data Nilai matakuliah anda dalam
variabel array
Langkah-langkah untuk membuat programnya disini dengan menggunakan Notepad.
1.Ketikan script dibawah ini
<html>
<head>
<title>Modul 8 | Praktik 3</title>
<link href='/style.css' rel='stylesheet' type='text/css'/>
<script src='/script.js' type='text/javascript'></script>
</head>
<body onload="document.body.style.backgroundColor=bg">
<div id="judul">Tugas Praktik (16)</div>
<div id="isi">
<div id="tengah">
<?php
$matakuliah = Array(1=>Array("Pendidikan Agama",90,80,90),2=>Array("Pendidikan Pancasila",80,85,90),3=>Array("Pengantar Teknologi Informasi",95,80,100),4=>Array("Algoritma dan Pemrograman",95,90,90),5=>Array("Kalkulus",90,80,85),6=>Array("Kewirausahaan",85,90,90),7=>Array("Pengantar Ekonomi",95,85,95),8=>Array("Bahasa Inggris",100,90,90),9=>Array("Aplikasi Komputer",80,90,95),10=>Array("Praktikum Aplikasi Komputer",85,90,80),11=>Array("Dasar Akuntansi 1",90,80,95));
echo "<table width=100% align=center>";
echo "<tr><th>Mata Kuliah</th><th>Ujian 1</th><th>Ujian 2</th><th>Ujian 3</th><th>Jumlah</th><th>Rata-Rata</th></tr>";
for ($a=1;$a<count($matakuliah);$a++) {
echo "<tr>";
echo "<td>".$matakuliah[$a][0]."</td>";
for ($b=1;$b<4;$b++) {
echo "<td align=center>".$matakuliah[$a][$b]."</td>";
}
echo "<td align=center>";
$jumlah = $matakuliah[$a][1]+$matakuliah[$a][2]+$matakuliah[$a][3];
echo $jumlah;
echo "</td><td align=center>";
$rata = number_format($jumlah/3,2);
echo $rata;
echo "</td></tr>";
}
echo "</table>";
?>
</div>
</div>
</body>
</html>
2. Simpan dengan nama “praktik_3” di document-root komputer. <head>
<title>Modul 8 | Praktik 3</title>
<link href='/style.css' rel='stylesheet' type='text/css'/>
<script src='/script.js' type='text/javascript'></script>
</head>
<body onload="document.body.style.backgroundColor=bg">
<div id="judul">Tugas Praktik (16)</div>
<div id="isi">
<div id="tengah">
<?php
$matakuliah = Array(1=>Array("Pendidikan Agama",90,80,90),2=>Array("Pendidikan Pancasila",80,85,90),3=>Array("Pengantar Teknologi Informasi",95,80,100),4=>Array("Algoritma dan Pemrograman",95,90,90),5=>Array("Kalkulus",90,80,85),6=>Array("Kewirausahaan",85,90,90),7=>Array("Pengantar Ekonomi",95,85,95),8=>Array("Bahasa Inggris",100,90,90),9=>Array("Aplikasi Komputer",80,90,95),10=>Array("Praktikum Aplikasi Komputer",85,90,80),11=>Array("Dasar Akuntansi 1",90,80,95));
echo "<table width=100% align=center>";
echo "<tr><th>Mata Kuliah</th><th>Ujian 1</th><th>Ujian 2</th><th>Ujian 3</th><th>Jumlah</th><th>Rata-Rata</th></tr>";
for ($a=1;$a<count($matakuliah);$a++) {
echo "<tr>";
echo "<td>".$matakuliah[$a][0]."</td>";
for ($b=1;$b<4;$b++) {
echo "<td align=center>".$matakuliah[$a][$b]."</td>";
}
echo "<td align=center>";
$jumlah = $matakuliah[$a][1]+$matakuliah[$a][2]+$matakuliah[$a][3];
echo $jumlah;
echo "</td><td align=center>";
$rata = number_format($jumlah/3,2);
echo $rata;
echo "</td></tr>";
}
echo "</table>";
?>
</div>
</div>
</body>
</html>
3. Buka browser dan ketikkan alamat http://localhost/yani/praktik_3.php
4. Lihat hasilnya di browser. Akan terlihat tampilan seperti pada gambar dibawah ini.
5.Selesai
4. Buatlah program menggunakan fungsi pemanggilan pointer array, untuk kasus
pembelian barang (berisi nama-nama barang dan harga barang)
Langkah-langkah untuk membuat programnya disini dengan menggunakan Notepad.
1.Ketikan script dibawah ini
<html>
<head>
<title>Modul 8 | Praktik 4</title>
<link href='/style.css' rel='stylesheet' type='text/css'/>
<script src='/script.js' type='text/javascript'></script>
</head>
<body onload="document.body.style.backgroundColor=bg">
<div id="judul">Tugas Praktik (17)</div>
<div id="isi">
<div id="tengah">
<table width=49% border=1 cellpadding=5 cellspacing=0 align=center style=float:left;>
<tr>
<th>Barang</td>
<th>Harga</td>
</tr>
<tr>
<td>Buku Tulis</td>
<td align=right>Rp 40000</td>
</tr>
<tr>
<td>Buku Gambar</td>
<td align=right>Rp 16000</td>
</tr>
<tr>
<td>Penggaris</td>
<td align=right>Rp 10000</td>
</tr>
<tr>
<td>Bolpoin</td>
<td align=right>Rp 12000</td>
</tr>
<tr>
<td>Pensil 2B</td>
<td align=right>Rp 20000</td>
</tr>
</table>
<?php
$barang["Buku Tulis"] = 40000;
$barang["Buku Gambar"] = 16000;
$barang["Penggaris"] = 10000;
$barang["Bolpoin"] = 12000;
$barang["Pensil 2B"] = 20000;
$harga=current($barang);
$namabarang=key($barang);
echo "<table width=49% border=1 cellpadding=5 cellspacing=0 align=center style=float:right;><tr><th>Fungsi</th><th>Hasil</th></tr>";
echo("<tr><td>CURRENT</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
$harga=end($barang);
$namabarang=key($barang);
echo("<tr><td>END</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
$harga=prev($barang);
$namabarang=key($barang);
echo("<tr><td>PREV</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
$harga=reset($barang);
$namabarang=key($barang);
echo("<tr><td>RESET</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
$harga=next($barang);
$namabarang=key($barang);
echo("<tr><td>NEXT</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
?>
</div>
</div>
</body>
</html>
2. Simpan dengan nama “praktik_4” di document-root komputer. <head>
<title>Modul 8 | Praktik 4</title>
<link href='/style.css' rel='stylesheet' type='text/css'/>
<script src='/script.js' type='text/javascript'></script>
</head>
<body onload="document.body.style.backgroundColor=bg">
<div id="judul">Tugas Praktik (17)</div>
<div id="isi">
<div id="tengah">
<table width=49% border=1 cellpadding=5 cellspacing=0 align=center style=float:left;>
<tr>
<th>Barang</td>
<th>Harga</td>
</tr>
<tr>
<td>Buku Tulis</td>
<td align=right>Rp 40000</td>
</tr>
<tr>
<td>Buku Gambar</td>
<td align=right>Rp 16000</td>
</tr>
<tr>
<td>Penggaris</td>
<td align=right>Rp 10000</td>
</tr>
<tr>
<td>Bolpoin</td>
<td align=right>Rp 12000</td>
</tr>
<tr>
<td>Pensil 2B</td>
<td align=right>Rp 20000</td>
</tr>
</table>
<?php
$barang["Buku Tulis"] = 40000;
$barang["Buku Gambar"] = 16000;
$barang["Penggaris"] = 10000;
$barang["Bolpoin"] = 12000;
$barang["Pensil 2B"] = 20000;
$harga=current($barang);
$namabarang=key($barang);
echo "<table width=49% border=1 cellpadding=5 cellspacing=0 align=center style=float:right;><tr><th>Fungsi</th><th>Hasil</th></tr>";
echo("<tr><td>CURRENT</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
$harga=end($barang);
$namabarang=key($barang);
echo("<tr><td>END</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
$harga=prev($barang);
$namabarang=key($barang);
echo("<tr><td>PREV</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
$harga=reset($barang);
$namabarang=key($barang);
echo("<tr><td>RESET</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
$harga=next($barang);
$namabarang=key($barang);
echo("<tr><td>NEXT</td><td align=right><span style=float:left>$namabarang</span>Rp $harga</td></tr>");
?>
</div>
</div>
</body>
</html>
3. Buka browser dan ketikkan alamat http://localhost/yani/praktik_4.php
4. Lihat hasilnya di browser. Akan terlihat tampilan seperti pada gambar dibawah ini.
5.Selesai.
0 komentar:
Posting Komentar