Senin, 09 November 2009

$klub = array ("Persik Kediri", "Persebaya Surabaya", "PSIS Semarang", "Persipura Jayapura");

print "Klub-klub yang pernah juara Liga Indonesia :
";

foreach ($klub as $nilai)
{
print "$nilai
";
}
?>

FOR



for ($i = 1; $i <= 5; $i++) { print $i ."
"; } $bila = 5; $pola = 1; print "
Bilangan ganjil antara 5 sampai 25
";
for ($pola=1; $pola<10; style="font-weight: bold;">Foreach

ARITMATIKA



$jumlah=$nilai1+$nilai2;
$kurang=$nilai1-$nilai2;
$kali=$nilai1*$nilai2;
$bagi=$nilai1/$nilai2;
$sisa=$nilai1%$nilai2;

print "Contoh operasi Aritmatika
";
print "Nilai \$nilai1=$nilai1 dan \$nilai2=$nilai2

";
print "\$nilai1 + \$nilai2 = $jumlah
";
print "\$nilai1 - \$nilai2 = $kurang
";
print "\$nilai1 * \$nilai2 = $kali <:br>"; print "\$nilai1 / \$nilai2 = $bagi
"; print "\$nilai1 % \$nilai2 = $sisa
"; ?>

0 komentar:


Free Blogspot Templates by Isnaini Dot Com and Bridal Dresses. Powered by Blogger