Arsip
Pemrograman Web dengan PHP
PHP
Tahukah Anda, PHP itu…..
1. Merupakan singkatan recursive dari PHP : Hypertext Prepocessor
2. Pertama kali dibuat oleh Rasmus Lerdorf pada tahun 1994.
3. Harus ditulis di antara tag :
<? dan ?>
<?php dan ?>
<script language=”php”> dan </script>
<% dan %>
4. Setiap satu statement (perintah) biasanya diakhiri dengan titik-koma (;)
5. CASE SENSITIVE untuk nama identifier yang dibuat oleh user (berupa
variable, konstanta, fungsi dll), namun TIDAK CASE SENSITIVE untuk
identifier built-in dari PHP. Jadi :
$nama ≠ $Nama ≠ $NAMA
hitungLuas() ≠ HitungLuas()
echo = ECHO
while = WHILE
6. Mudah dipelajari.
Say Hello to PHP
1. Ketikkan perintah di bawah ini di editor :
Program 2.1
Nama File : hello.php
Deskripsi : Program sederhana menampilkan sebuah string di layar.
<?php
echo “Hello, Nama saya Reza “;
?>
2. Simpan dengan nama “hello.php” di document-root komputer Anda.
3. Buka browser dan ketikkan alamat http://localhost/hello.php
4. Lihat hasilnya di browser
Variabel
Digunakan untuk menyimpan sebuah value, data atau informasi
Nama variabel diawali dengan tanda $
Panjang tidak terbatas
Setelah tanda $ diawali oleh huruf atau under-scrore (_). Karakter
berikutnya bisa terdiri dari huruf, angka, dan karakter tertentu yang
diperbolehkan (karakter ASCII dari 127 – 255).
Bersifat case-sensitive.
Tidak perlu dideklarasikan.
Tidak boleh mengandung spasi.
Contoh :Benar
– $_name
– $first_name
– $name3
– $name_3
Contoh :Salah
– $3name
– $name?
– $first+name
– $first.name
– $first name
Program 2.2
Nama File : variabel.php
Deskripsi : Program mengisi dan menampilkan variabel di layar.
<?php
$nim = “3311211018”;
$nama = ‘Reza Hidayatulloh Alazizi’;
echo “NIM : ” . $nim . “<br>”;
echo “Nama : $nama”;
?>
Tipe Data
Pada PHP, tipe data variabel tidak didefinisikan oleh programmer, akan tetapi
secara otomatis ditentukan oleh intepreter PHP. Namun demikian, PHP
mendukung 8 (delapan) buah tipe data primitif, yaitu :
1. boolean
2. integer
3. float
4. string
5. array
6. object
7. resource
8. NULL
Program 2.3
Nama File : tipe.php
Deskripsi : Program contoh penanganan beberapa tipe data dasar dalam PHP.
<?php
$nim = “3311211018”;
$nama = ‘Reza Hidayatulloh Alazizi’;
$umur = 23;
$nilai = 82.25;
$status = TRUE;
echo “NIM : ” . $nim . “<br>”;
echo “Nama : $nama<br>”;
print “Umur : ” . $umur; print “<br>”;
printf (“Nilai : %.3f<br>”, $nilai);
if ($status)
echo “Status : Aktif”;
else
echo “Status : Tidak Aktif”;
?>
Konstanta
Konstanta merupakan variabel konstan yang nilainya tidak berubah-ubah. Untuk
mendefinisikan konstanta dalam PHP, menggunakan fungsi define()
Program 2.4
Nama File : konstanta.php
Deskripsi : Program penggunaan konstanta dalam PHP.
<?
define (“NAMA”, “Reza Hidayatulloh Alazizi”);
define (“NILAI”, 90);
//NAMA = “Riza”; //akan menyebabkan error
echo “Nama : ” . NAMA;
echo “<br>Nilai : ” . NILAI;
?>
Operator dalam PHP
Jenis Operator Operator Contoh Keterangan
Aritmatika + $a + $b Pertambahan
– $a – $b Pengurangan
* $a * $b Perkalian
/ $a / $b Pembagian
% $a % $b Modulus, sisa pembagian
Penugasan = $a = 4; $a diisi dengan 4
Bitwise & $a & $b Bitwise AND
| $a | $b Bitwise OR
^ $a ^ $b Bitwise XOR
~ ~$b Bitwise NOT
<< $a << $b Shift Left
>> $a >> $b Shift Right
Perbandingan == $a == $b Sama dengan
=== $a ===$b Identik
!= $a != $b Tidak sama dengan
<> $a <> $b Tidak sama dengan
!== $a !== $b Tidak identik
< $a < $b Kurang dari
> $a > $b Lebih dari
<= $a <= $b Kurang dari sama dengan
>= $a >= $b Lebih dari sama dengan
Logika and $a and $b TRUE jika $a dan $b TRUE
&& $a && $b TRUE jika $a dan $b TRUE
or $a or $b TRUE jika $a atau $b TRUE
|| $a || $b TRUE jika $a dan/atau $b TRUE
xor $a xor $b TRUE jika $a atau $b TRUE, tapi
tidak keduanya
! !$a TRUE jika $a FALSE
String . $a . $b Penggabungan string $a dan $b
LATIHAN DASAR-DASAR PENGETIKAN
Latihan dasar, mulailah dengan mengetik huruf-huruf ini.
1. asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl;
asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl; asdfjkl;
2. qweruiop; qweruiop; qweruiop; qweruiop; qweruiop; qweruiop;
qweruiop; qweruiop; qweruiop; qweruiop; qweruiop; qweruiop;
qweruiop; qweruiop; qweruiop; qweruiop; qweruiop; qweruiop;
qweruiop; qweruiop; qweruiop; qweruiop; qweruiop; qweruiop;
qweruiop; qweruiop; qweruiop; qweruiop; qweruiop; qweruiop;
3. zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./
zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./
zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./
zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./ zxcvm,./
4.
1. The quick brown fox jump over the lazy dog
2. The quick brown fox jump over the lazy dog
3. The quick brown fox jump over the lazy dog
4. The quick brown fox jump over the lazy dog
5. The quick brown fox jump over the lazy dog
6. The quick brown fox jump over the lazy dog
7. The quick brown fox jump over the lazy dog
8. The quick brown fox jump over the lazy dog
9. The quick brown fox jump over the lazy dog
10. The quick brown fox jump over the lazy dog
11. The quick brown fox jump over the lazy dog
12. The quick brown fox jump over the lazy dog
13. The quick brown fox jump over the lazy dog
14. The quick brown fox jump over the lazy dog
15. The quick brown fox jump over the lazy dog
16. The quick brown fox jump over the lazy dog
17. The quick brown fox jump over the lazy dog
18. The quick brown fox jump over the lazy dog
19. The quick brown fox jump over the lazy dog
20. The quick brown fox jump over the lazy dog
21. The quick brown fox jump over the lazy dog
22. The quick brown fox jump over the lazy dog
23. The quick brown fox jump over the lazy dog
24. The quick brown fox jump over the lazy dog
25. The quick brown fox jump over the lazy dog
26. The quick brown fox jump over the lazy dog
27. The quick brown fox jump over the lazy dog
28. The quick brown fox jump over the lazy dog
29. The quick brown fox jump over the lazy dog
30. The quick brown fox jump over the lazy dog
31. The quick brown fox jump over the lazy dog
32. The quick brown fox jump over the lazy dog
33. The quick brown fox jump over the lazy dog
34. The quick brown fox jump over the lazy dog
35. The quick brown fox jump over the lazy dog
36. The quick brown fox jump over the lazy dog
37. The quick brown fox jump over the lazy dog
38. The quick brown fox jump over the lazy dog
39. The quick brown fox jump over the lazy dog
40. The quick brown fox jump over the lazy dog
41. The quick brown fox jump over the lazy dog
42. The quick brown fox jump over the lazy dog
43. The quick brown fox jump over the lazy dog
44. The quick brown fox jump over the lazy dog
45. The quick brown fox jump over the lazy dog
46. The quick brown fox jump over the lazy dog
47. The quick brown fox jump over the lazy dog
48. The quick brown fox jump over the lazy dog
49. The quick brown fox jump over the lazy dog
50. The quick brown fox jump over the lazy dog
5.
1. Typewriter quick stewardess helicopter brown polycarbonat jump
2. Typewriter quick stewardess helicopter brown polycarbonat jump
3. Typewriter quick stewardess helicopter brown polycarbonat jump
4. Typewriter quick stewardess helicopter brown polycarbonat jump
5. Typewriter quick stewardess helicopter brown polycarbonat jump
6. Typewriter quick stewardess helicopter brown polycarbonat jump
7. Typewriter quick stewardess helicopter brown polycarbonat jump
8. Typewriter quick stewardess helicopter brown polycarbonat jump
9. Typewriter quick stewardess helicopter brown polycarbonat jump
10. Typewriterquick stewardess helicopter brown polycarbonat jump
11. Typewriter quick stewardess helicopter brown polycarbonat jump
12. Typewriter quick stewardess helicopter brown polycarbonat jump
13. Typewriter quick stewardess helicopter brown polycarbonat jump
14. Typewriter quick stewardess helicopter brown polycarbonat jump
15. Typewriter quick stewardess helicopter brown polycarbonat jump
16. Typewriter quick stewardess helicopter brown polycarbonat jump
17. Typewriter quick stewardess helicopter brown polycarbonat jump
18. Typewriter quick stewardess helicopter brown polycarbonat jump
19. Typewriter quick stewardess helicopter brown polycarbonat jump
20. Typewriter quick stewardess helicopter brown polycarbonat jump
JUAL MOTOR FU-150
Ane lg butuh duwit nie,, huft…!! Terpaksa Ane mo jual motor kesayangan Satria FU-150 tahun 2008 kondisi masih oke aktifitas cuma buat kuliah,, berminat hubungi:,,,,,,,,