THOUSANDS OF FREE BLOGGER TEMPLATES

Senin, 07 September 2009

foreach


<?php$klub = array ("Persik Kediri", "Persebaya Surabaya", "PSIS Semarang", "Persipura Jayapura");
print "Klub-klub yang pernah juara Liga Indonesia :<br>";
foreach ($klub as $nilai){ print "$nilai <br>";}?>

aritmatika


<?php$nilai1=32;$nilai2=8;
$jumlah=$nilai1+$nilai2;$kurang=$nilai1-$nilai2;$kali=$nilai1*$nilai2;$bagi=$nilai1/$nilai2;$sisa=$nilai1%$nilai2;
print "Contoh operasi Aritmatika <br>";print "Nilai \$nilai1=$nilai1 dan \$nilai2=$nilai2 <br><br>";print "\$nilai1 + \$nilai2 = $jumlah <br>";print "\$nilai1 - \$nilai2 = $kurang <br>";print "\$nilai1 * \$nilai2 = $kali <br>";print "\$nilai1 / \$nilai2 = $bagi <br>";print "\$nilai1 % \$nilai2 = $sisa <br>";?>

for


<?phpfor ($i = 1; $i <= 5; $i++) { print $i ."<br> ";}
$bila = 5;$pola = 1;
print " <br> Bilangan ganjil antara 5 sampai 25 <br>";for ($pola=1; $pola<10; $pola++){ $bila += 2; print "$bila <br>";} ?>