lukmanunindra

Home » Web 2 » Pertemuan 6 PHP

Pertemuan 6 PHP

Penggunaan Array di PHP

<?php

$nilai = array(7, 8, 7, 9,10);
echo “Daftar Nilai : “;
foreach ($nilai as $value) {
echo $value .”, “;
}

echo “<br><br>”;
$nama[“Zakwan”] = “7”;
$nama[“Rama”] = “8”;
$nama[“Alwan”] = “7”;
$nama[“El Haqqi”] = “9”;
$nama[“Cecil”] = “10”;

foreach( $nama as $key => $value){
echo “Nama: $key, Nilai: $value <br />”;
}

?>

Advertisements
%d bloggers like this: