BAB I - Mari Memulai Belajar Dengan PHP
Saat ingin mempelajari bahasa pemrograman yang baru, kita
harus memulai dari memahami dan mengenali perintah dasar dan fungsinya, dimana
kita akan mempelajarinya di sini.
Fokus di bab ini adalah fundamental dari HTML dan PHP, serta
bagaimana kedua bahasa pemrograman ini bekerja sama.
PERINTAH DASAR HTML
Semua halaman Web dibuat menggunakan HTML (Hypertext Markup
Languange).
PERINTAH DASAR PHP
Untuk membuat halaman pertama PHP, kita akan memulai dengan
membuat skrip HTML terlebih dahulu. Sangat penting untuk mengetahui alasannya
:: Web Browser adalah aplikasi client yang mengerti bahasa HTML; PHP adalah teknologi server, yang tidak
bisa berfungsi di client. Untuk mengatasi masalah ini, PHP akan dikirim ke
server untuk untuk diubah menjadi HTML yang berjalan di Web brower.
Ada 3 perbedaan antara HTML dan PHP :
·
Script PHP harus di save dengan ekstensi *.php
sedangkan HTML di save dengan ekstensi *.html
·
Perintah PHP di awali dengan kode
·
Script PHP harus dijalankan pada PHP-enabled Web server
(sedangkan HTML halaman dapat dilihat di komputer manapun, langsung di browser).
MENGIRIM
TEKS KE BROWSER
Kita akan menggunakan PHP paling sering untuk mengirim informasi
ke browser dalam bentuk teks biasa dan HTML tag. Untuk melakukannya,
gunakan print : print "something"; Cukup ketik kata ‘print’ , diikuti dengan apa yang ingin ditampilkan: pesan sederhana, nilai dari variabel, hasil perhitungan,
dan
sebagainya.
Untuk mencetak pesan sederhana :
</span> <span class="hps">Hello, World</span> </span>!<span class="hps"><span style="mso-ansi-language:IN" lang="IN"></</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">title></span><br>
<span class="hps"></</span> <span class="hps">head></span><br>
<span class="hps"><body></span><br>
<span class="hps"><p></span> <span class="hps">berikut</span> <span class="hps">ini diciptakan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">oleh PHP</span></span><span style="mso-ansi-language:IN" lang="IN">:<br>
<span class="hps">Kebanyakan dari</span> <span class="hps">kode ini</span> <span class="hps">adalah HTML</span> <span class="hps">standar.</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Baris
terakhir</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">akan digunakan</span> <span class="hps">untuk membedakan</span><br>
<span class="hps">antara</span></span><span class="hps"><span lang="IN"> </span></span><span style="mso-ansi-language:IN" lang="IN">kode <span class="hps">HTML dan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">PHP</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">yang dihasilkan</span>.<br>
<span class="hps">2.</span> <span class="hps">Pada jenis</span>, <span class="hps">baris
berikutnya</span> <span class="hps"><</span></span>?php sebagai tag awal php<span style="mso-ansi-language:IN" lang="IN"><br>
<span class="hps">3.</span> <span class="hps">Menambahkan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">print
"</span></span><span style="mso-ansi-language:IN" lang="IN">H</span>ello,
World<span style="mso-ansi-language:IN" lang="IN">!";</span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Mencetak</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">kalimat</span> </span><span class="hps">Hello, World</span><span style="mso-ansi-language:IN" lang="IN">! </span><span class="hps">a</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">dalah</span></span><span lang="IN"> </span><span class="hps">l</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">angkah pertama</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">referensi</span> <span class="hps">pemrograman.</span>
<span class="hps">Meskipun</span> <span class="hps">alasan</span> <span class="hps">sepele
untuk</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">menggunakan PHP</span></span><span style="mso-ansi-language:IN" lang="IN">, Anda <span class="hps">tidak benar-benar</span> <span class="hps">seorang programmer</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">sampai Anda melakukan</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">setidaknya satu</span></span><span lang="IN"> </span><span class="hps">Hello, World</span><span style="mso-ansi-language:IN" lang="IN">! </span></p>
<p class="MsoNormal"><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">4. Tutup bagian PHP
dan </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"">selesaikan </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">halaman HTML:<br>
?><br>
</ p><br>
</ body><br>
</ html><br>
5. Simpan file sebagai hello.php, </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"">lalu buka browser
anda, tapi sebelum itu nyalakan aplikasi server di komputer anda. </span></p><p class="MsoNormal"><span style=""> </span></p>
<p class="MsoNormal"><b style="mso-bidi-font-weight:normal">MENAMBAHKAN KOMENTAR
SCRIPT</b></p><p class="MsoNormal"><b style=""> </b></p>
<p class="MsoNormal"><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Komentar</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">merupakan bagian integral
dari</span> <span class="hps">pemrograman,</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">bukan karena mereka</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">melakukan apa pun </span></span><span class="hps">tetapi </span><span class="hps"><span style="mso-ansi-language:
IN" lang="IN">karena</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">mereka</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">membantu Anda mengingat</span> <span class="hps">mengapa Anda melakukan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">sesuatu.</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">Komputer</span> <span class="hps">mengabaikan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">komentar</span></span><span style="mso-ansi-language:IN" lang="IN"> </span>ini <span class="hps"><span style="mso-ansi-language:IN" lang="IN">ketika </span>script di proses</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal"><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">Selain itu, komentar
PHP tidak pernah</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">dikirim ke browser Web dan karena itu</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">tetap rahasia Anda.</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">PHP mendukung tiga
cara menambahkan komentar. Anda dapat </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"">berkomentar dengan </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">menempatkan tanda / / atau # pada</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">awal baris yang
ingin diabaikan</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"">, contoh : </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
mso-ansi-language:IN" lang="IN">/ / Ini adalah komentar.<br>
Anda juga dapat menggunakan / / atau # untuk memulai</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">komentar pada
akhir baris PHP, seperti:<br>
print "Halo"; / / Hanya ucapan.<br>
Meskipun sebagian besar masalah gaya, / / adalah</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">jauh lebih umum
digunakan di PHP dari #.<br>
Anda dapat komentar dari beberapa baris dengan</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">menggunakan / * untuk
memulai komentar dan * / untuk</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">menyimpulkan itu:<br>
/ * Ini adalah</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">multi-baris komentar. * /<br>
Beberapa programmer juga lebih suka</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman""> jenis komentar ini</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
mso-ansi-language:IN"> <span lang="IN">karena mengandung </span></span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"">tag
pembuka dan penutup,</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"">untuk
meberikan kapan</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN"> <span lang="IN">komentar
dimulai dan berakhir.</span></span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman""></span></p>
<blockquote class="tr_bq"><p><i style="font-family: "Courier New",Courier,monospace;"><b><font class="hps"><font lang="IN"></font></font><font lang="IN"></font><br><font lang="IN">
<font class="hps"><title></span> <span class="hps">Hello, World</span> </span>!<span class="hps"><span style="mso-ansi-language:IN" lang="IN"></</span></span><span style="" lang="IN"> <span class="hps">title></span></span><br><span style="" lang="IN">
<span class="hps"></</span> <span class="hps">head></span></span><br><span style="" lang="IN">
<span class="hps"><body></span></span><br><span style="mso-ansi-language:IN" lang="IN">
<span class="hps"><p></span> <span class="hps">berikut</span> <span class="hps">ini diciptakan</span> </span><span class="hps"></span><span style="mso-ansi-language:IN" lang="JA"></span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">oleh PHP</span></span><span style="" lang="IN">:</span></b></i><br><span style="" lang="IN"></span></blockquote><p class="MsoNormal"><span style="mso-ansi-language:IN" lang="IN">
<span class="hps">Kebanyakan dari</span> <span class="hps">kode ini</span> <span class="hps">adalah HTML</span> <span class="hps">standar.</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Baris
terakhir</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">akan digunakan</span> <span class="hps">untuk membedakan</span><br>
<span class="hps">antara</span></span><span class="hps"><span lang="IN"> </span></span><span style="mso-ansi-language:IN" lang="IN">kode <span class="hps">HTML dan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">PHP</span></span><span style="" lang="IN"> <span class="hps">yang dihasilkan</span>.<br>
</span></p><ul><li><span style="mso-ansi-language:IN" lang="IN"><span class="hps"></span><span style="color: rgb(0, 0, 255);" class="hps">Pada jenis</span><span style="color: rgb(0, 0, 255);">, </span><span style="color: rgb(0, 0, 255);" class="hps">baris
berikutnya</span><span style="color: rgb(0, 0, 255);"> </span><span style="color: rgb(0, 0, 255);" class="hps"><</span></span><span style="color: rgb(0, 0, 255);">?php sebagai tag awal php</span></li></ul><ul><li><span style="mso-ansi-language:IN" lang="IN">
<span class="hps"></span><span style="color: rgb(0, 0, 255);" class="hps">Menambahkan</span></span><span style="color: rgb(0, 0, 255);" lang="IN"> </span><span style="color: rgb(0, 0, 255);" class="hps"><span style="mso-ansi-language:IN" lang="IN">print
"</span></span><span style="color: rgb(0, 0, 255);" lang="IN">Hello,
World!";</span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Mencetak</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">kalimat</span> </span><span class="hps">Hello, World</span><span style="mso-ansi-language:IN" lang="IN">! </span><span class="hps">a</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">dalah</span></span><span lang="IN"> </span><span class="hps">l</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">angkah pertama</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">referensi</span> <span class="hps">pemrograman.</span>
<span class="hps">Meskipun</span> <span class="hps">alasan</span> <span class="hps">sepele
untuk</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">menggunakan PHP</span></span><span style="mso-ansi-language:IN" lang="IN">, Anda <span class="hps">tidak benar-benar</span> <span class="hps">seorang programmer</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">sampai Anda melakukan</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">setidaknya satu</span></span><span lang="IN"> </span><span class="hps">Hello, World</span><span style="mso-ansi-language:IN" lang="IN">! </span></li></ul>
<ul style="color: rgb(0, 0, 255);"><li><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">Tutup bagian PHP
dan </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"">selesaikan </span><span style="" lang="IN">halaman HTML:</span></li></ul><blockquote class="tr_bq"><span style="" lang="IN">
<i style="font-family: "Courier New",Courier,monospace;"><b>?></b></i></span><i style="font-family: "Courier New",Courier,monospace;"><b><br><span style="" lang="IN">
</ p></span><br><span style="" lang="IN">
</ body></span><br><span style="" lang="IN">
</ html></span></b></i><br><span style="" lang="IN"></span></blockquote><ul><li><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">
<span style="color: rgb(0, 0, 255);">Simpan file sebagai hello.php</span>, </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"">lalu buka browser
anda, tapi sebelum itu nyalakan aplikasi server di komputer anda. </span></li></ul><p class="MsoNormal"><span style=""> </span></p>
<p style="background-color: rgb(0, 0, 0); color: rgb(243, 243, 243);" class="MsoNormal"><b style="mso-bidi-font-weight:normal">MENAMBAHKAN KOMENTAR
SCRIPT</b></p><p class="MsoNormal"><b style=""> </b></p>
<p class="MsoNormal"><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Komentar</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">merupakan bagian integral
dari</span> <span class="hps">pemrograman,</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">bukan karena mereka</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">melakukan apa pun </span></span><span class="hps">tetapi </span><span class="hps"><span style="mso-ansi-language:
IN" lang="IN">karena</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">mereka</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">membantu Anda mengingat</span> <span class="hps">mengapa Anda melakukan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">sesuatu.</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">Komputer</span> <span class="hps">mengabaikan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">komentar</span></span><span style="mso-ansi-language:IN" lang="IN"> </span>ini <span class="hps"><span style="mso-ansi-language:IN" lang="IN">ketika </span>script di proses</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal"><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">Selain itu, komentar
PHP tidak pernah</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">dikirim ke browser Web dan karena itu</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">tetap rahasia Anda.</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">PHP mendukung tiga
cara menambahkan komentar. Anda dapat </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"">berkomentar dengan </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">menempatkan tanda / / atau # pada</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">awal baris yang
ingin diabaikan</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"">, contoh : </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
mso-ansi-language:IN" lang="IN">/ / Ini adalah komentar.<br>
Anda juga dapat menggunakan / / atau # untuk memulai</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">komentar pada
akhir baris PHP, seperti:<br>
print "Halo"; / / Hanya ucapan.<br>
Meskipun sebagian besar masalah gaya, / / adalah</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">jauh lebih umum
digunakan di PHP dari #.<br>
Anda dapat komentar dari beberapa baris dengan</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">menggunakan / * untuk
memulai komentar dan * / untuk</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">menyimpulkan itu:<br>
/ * Ini adalah</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">multi-baris komentar. * /<br>
Beberapa programmer juga lebih suka</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman""> jenis komentar ini</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
mso-ansi-language:IN"> <span lang="IN">karena mengandung </span></span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"">tag
pembuka dan penutup,</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"">untuk
meberikan kapan</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN"> <span lang="IN">komentar
dimulai dan berakhir.</span></span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman""></span></p>
<blockquote class="tr_bq"><p><b><font class="hps"><font lang="IN"></font></font><font lang="IN"></font><br><font lang="IN">
<font class="hps"><title></span> <span class="hps">Hello, World</span> </span>!<span class="hps"><span style="mso-ansi-language:IN" lang="IN"></</span></span><span style="" lang="IN"> <span class="hps">title></span></span><br><span style="" lang="IN">
<span class="hps"></</span> <span class="hps">head></span></span><br><span style="" lang="IN">
<span class="hps"><body></span></span><br></b><span style="mso-ansi-language:IN" lang="IN">
<b><span class="hps"><p></span></b> <span class="hps">berikut</span> <span class="hps">ini diciptakan</span> </span><span class="hps"><span style="font-family:"MS Gothic";mso-bidi-font-family:
"MS Gothic";mso-ansi-language:IN" lang="JA"></span></span><span style="mso-ansi-language:IN" lang="JA"></span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">oleh PHP</span></span><span style="" lang="IN">:</span><br><span style="" lang="IN"></span></blockquote><p class="MsoNormal"><span style="mso-ansi-language:IN" lang="IN">
<span class="hps">Kebanyakan dari</span> <span class="hps">kode ini</span> <span class="hps">adalah HTML</span> <span class="hps">standar.</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Baris
terakhir</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">akan digunakan</span> <span class="hps">untuk membedakan</span><br>
<span class="hps">antara</span></span><span class="hps"><span lang="IN"> </span></span><span style="mso-ansi-language:IN" lang="IN">kode <span class="hps">HTML dan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">PHP</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">yang dihasilkan</span>.<br>
<span style="color: rgb(0, 0, 255);" class="hps">2.</span><span style="color: rgb(0, 0, 255);"> </span><span style="color: rgb(0, 0, 255);" class="hps">Pada jenis</span><span style="color: rgb(0, 0, 255);">, </span><span style="color: rgb(0, 0, 255);" class="hps">baris
berikutnya</span><span style="color: rgb(0, 0, 255);"> </span><span style="color: rgb(0, 0, 255);" class="hps"><</span></span><span style="color: rgb(0, 0, 255);">?php sebagai tag awal php</span><span style="mso-ansi-language:IN" lang="IN"><br>
<span style="color: rgb(0, 0, 255);" class="hps">3.</span><span style="color: rgb(0, 0, 255);"> </span><span style="color: rgb(0, 0, 255);" class="hps">Menambahkan</span></span><span style="color: rgb(0, 0, 255);" lang="IN"> </span><span style="color: rgb(0, 0, 255);" class="hps"><span style="mso-ansi-language:IN" lang="IN">print
"</span></span><span style="color: rgb(0, 0, 255);">Hello,
World</span><span style="mso-ansi-language:IN" lang="IN"><span style="color: rgb(0, 0, 255);">!"</span>;</span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Mencetak</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">kalimat</span> </span><span class="hps">Hello, World</span><span style="mso-ansi-language:IN" lang="IN">! </span><span class="hps">a</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">dalah</span></span><span lang="IN"> </span><span class="hps">l</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">angkah pertama</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">referensi</span> <span class="hps">pemrograman.</span>
<span class="hps">Meskipun</span> <span class="hps">alasan</span> <span class="hps">sepele
untuk</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">menggunakan PHP</span></span><span style="mso-ansi-language:IN" lang="IN">, Anda <span class="hps">tidak benar-benar</span> <span class="hps">seorang programmer</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">sampai Anda melakukan</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">setidaknya satu</span></span><span lang="IN"> </span><span class="hps">Hello, World</span><span style="mso-ansi-language:IN" lang="IN">! </span></p>
<p class="MsoNormal"><span style="color: rgb(0, 0, 255);">4. Tutup bagian PHP
dan selesaikan </span><span style="" lang="IN"><span style="color: rgb(0, 0, 255);">halaman HTML:</span><br></span></p><blockquote class="tr_bq"><span style="" lang="IN">
<b>?></b></span><b><br><span style="" lang="IN">
</ p></span><br><span style="" lang="IN">
</ body></span><br><span style="" lang="IN">
</ html></span></b><br><span style="" lang="IN"></span></blockquote><p class="MsoNormal"><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">
<span style="color: rgb(0, 0, 255);">5. Simpan file sebagai hello.php, </span></span><span style="color: rgb(0, 0, 255);">lalu buka browser
anda, tapi sebelum itu nyalakan aplikasi server di komputer anda. </span></p><p class="MsoNormal"><span style="color: rgb(0, 0, 255);"> </span></p>
<p style="background-color: rgb(0, 0, 0); color: rgb(243, 243, 243);" class="MsoNormal"><b style="mso-bidi-font-weight:normal">MENAMBAHKAN KOMENTAR
SCRIPT</b></p><p class="MsoNormal"><b style=""> </b></p>
<p class="MsoNormal"><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Komentar</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">merupakan bagian integral
dari</span> <span class="hps">pemrograman,</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">bukan karena mereka</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">melakukan apa pun </span></span><span class="hps">tetapi </span><span class="hps"><span style="mso-ansi-language:
IN" lang="IN">karena</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">mereka</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">membantu Anda mengingat</span> <span class="hps">mengapa Anda melakukan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">sesuatu.</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">Komputer</span> <span class="hps">mengabaikan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">komentar</span></span><span style="mso-ansi-language:IN" lang="IN"> </span>ini <span class="hps"><span style="mso-ansi-language:IN" lang="IN">ketika </span>script di proses</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal"><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">Selain itu, komentar
PHP tidak pernah</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">dikirim ke browser Web dan karena itu</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">tetap rahasia Anda.</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">PHP mendukung tiga
cara menambahkan komentar. Anda dapat </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"">berkomentar dengan </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">menempatkan tanda / / atau # pada</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">awal baris yang
ingin diabaikan</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"">, contoh : </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
mso-ansi-language:IN" lang="IN">/ / Ini adalah komentar.<br>
Anda juga dapat menggunakan / / atau # untuk memulai</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">komentar pada
akhir baris PHP, seperti:<br>
print "Halo"; / / Hanya ucapan.<br>
Meskipun sebagian besar masalah gaya, / / adalah</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">jauh lebih umum
digunakan di PHP dari #.<br>
Anda dapat komentar dari beberapa baris dengan</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">menggunakan / * untuk
memulai komentar dan * / untuk</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">menyimpulkan itu:<br>
/ * Ini adalah</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">multi-baris komentar. * /<br>
Beberapa programmer juga lebih suka</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman""> jenis komentar ini</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
mso-ansi-language:IN"> <span lang="IN">karena mengandung </span></span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"">tag
pembuka dan penutup,</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"">untuk
meberikan kapan</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN"> <span lang="IN">komentar
dimulai dan berakhir.</span></span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman""></span></p>
<p><br><font lang="IN">
<br>
<font class="hps"><title></span> <span class="hps">Hello, World</span> </span>!<span class="hps"><span style="mso-ansi-language:IN" lang="IN"></</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">title></span><br>
<span class="hps"></</span> <span class="hps">head></span><br>
<span class="hps"><body></span><br>
<span class="hps"><p></span> <span class="hps">berikut</span> <span class="hps">ini diciptakan</span> </span><span class="hps"><span style="font-family:"MS Gothic";mso-bidi-font-family:
"MS Gothic";mso-ansi-language:IN" lang="JA"></span></span><span style="mso-ansi-language:IN" lang="JA"></span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">oleh PHP</span></span><span style="mso-ansi-language:IN" lang="IN">:<br>
<span class="hps">Kebanyakan dari</span> <span class="hps">kode ini</span> <span class="hps">adalah HTML</span> <span class="hps">standar.</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Baris
terakhir</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">akan digunakan</span> <span class="hps">untuk membedakan</span><br>
<span class="hps">antara</span></span><span class="hps"><span lang="IN"> </span></span><span style="mso-ansi-language:IN" lang="IN">kode <span class="hps">HTML dan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">PHP</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">yang dihasilkan</span>.<br>
<span style="color: rgb(0, 0, 255);" class="hps">2.</span><span style="color: rgb(0, 0, 255);"> </span><span style="color: rgb(0, 0, 255);" class="hps">Pada jenis</span><span style="color: rgb(0, 0, 255);">, </span><span style="color: rgb(0, 0, 255);" class="hps">baris
berikutnya</span><span style="color: rgb(0, 0, 255);"> </span><span style="color: rgb(0, 0, 255);" class="hps"><</span></span><span style="color: rgb(0, 0, 255);">?php sebagai tag awal php</span><span style="mso-ansi-language:IN" lang="IN"><br>
<span style="color: rgb(0, 0, 255);" class="hps">3.</span><span style="color: rgb(0, 0, 255);"> </span><span style="color: rgb(0, 0, 255);" class="hps">Menambahkan</span></span><span style="color: rgb(0, 0, 255);" lang="IN"> </span><span style="color: rgb(0, 0, 255);" class="hps"><span style="mso-ansi-language:IN" lang="IN">print
"</span></span><span style="color: rgb(0, 0, 255);">Hello,
World</span><span style="mso-ansi-language:IN" lang="IN"><span style="color: rgb(0, 0, 255);">!"</span>;</span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Mencetak</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">kalimat</span> </span><span class="hps">Hello, World</span><span style="mso-ansi-language:IN" lang="IN">! </span><span class="hps">a</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">dalah</span></span><span lang="IN"> </span><span class="hps">l</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">angkah pertama</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">referensi</span> <span class="hps">pemrograman.</span>
<span class="hps">Meskipun</span> <span class="hps">alasan</span> <span class="hps">sepele
untuk</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">menggunakan PHP</span></span><span style="mso-ansi-language:IN" lang="IN">, Anda <span class="hps">tidak benar-benar</span> <span class="hps">seorang programmer</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">sampai Anda melakukan</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">setidaknya satu</span></span><span lang="IN"> </span><span class="hps">Hello, World</span><span style="mso-ansi-language:IN" lang="IN">! </span></p>
<p class="MsoNormal"><span style="color: rgb(0, 0, 255);">4. Tutup bagian PHP
dan selesaikan </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN"><span style="color: rgb(0, 0, 255);">halaman HTML:</span><br>
?><br>
</ p><br>
</ body><br>
</ html><br>
5. <span style="color: rgb(0, 0, 255);">Simpan file sebagai hello.php</span>, </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"">lalu buka browser
anda, tapi sebelum itu nyalakan aplikasi server di komputer anda. </span></p><p class="MsoNormal"><span style=""> </span></p>
<p style="background-color: rgb(0, 255, 0); color: rgb(102, 0, 0);" class="MsoNormal"><b style="mso-bidi-font-weight:normal">MENAMBAHKAN KOMENTAR
SCRIPT</b></p><p class="MsoNormal"><b style=""> </b></p>
<p class="MsoNormal"><span class="hps"><span style="mso-ansi-language:IN" lang="IN">Komentar</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">merupakan bagian integral
dari</span> <span class="hps">pemrograman,</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">bukan karena mereka</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">melakukan apa pun </span></span><span class="hps">tetapi </span><span class="hps"><span style="mso-ansi-language:
IN" lang="IN">karena</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">mereka</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">membantu Anda mengingat</span> <span class="hps">mengapa Anda melakukan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">sesuatu.</span></span><span style="mso-ansi-language:IN" lang="IN"> <span class="hps">Komputer</span> <span class="hps">mengabaikan</span></span><span lang="IN"> </span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">komentar</span></span><span style="mso-ansi-language:IN" lang="IN"> </span>ini <span class="hps"><span style="mso-ansi-language:IN" lang="IN">ketika </span>script di proses</span><span class="hps"><span style="mso-ansi-language:IN" lang="IN">.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal"><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">Selain itu, komentar
PHP tidak pernah</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">dikirim ke browser Web dan karena itu</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">tetap rahasia Anda.</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">PHP mendukung tiga
cara menambahkan komentar. Anda dapat </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"">berkomentar dengan </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">menempatkan tanda / / atau # pada</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">awal baris yang
ingin diabaikan</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"">, contoh : </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
mso-ansi-language:IN" lang="IN">/ / Ini adalah komentar.<br>
Anda juga dapat menggunakan / / atau # untuk memulai</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">komentar pada
akhir baris PHP, seperti:<br>
print "Halo"; / / Hanya ucapan.<br>
Meskipun sebagian besar masalah gaya, / / adalah</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">jauh lebih umum
digunakan di PHP dari #.<br>
Anda dapat komentar dari beberapa baris dengan</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN">
</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN" lang="IN">menggunakan / * untuk
memulai komentar dan * / untuk</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:
"Times New Roman";mso-ansi-language:IN" lang="IN">menyimpulkan itu:<br>
/ * Ini adalah</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman"" lang="IN"> </span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-ansi-language:
IN" lang="IN">multi-baris komentar. * /<br>
Beberapa programmer juga lebih suka</span><span style="mso-fareast-font-family:
"Times New Roman";mso-bidi-font-family:"Times New Roman""> jenis komentar ini</span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
mso-ansi-language:IN"> <span lang="IN">karena mengandung </span></span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"">tag
pembuka dan penutup,</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN"> </span><span style="mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"">untuk
meberikan kapan</span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";mso-ansi-language:IN"> <span lang="IN">komentar
dimulai dan berakhir.</span></span><span style="mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman""></span></p>
1. Mulailah sebuah dokumen HTML baru dengan nama hello.php :
<html>
<title> Hello, World !</ title>
</ head>
<body>
<p> berikut ini diciptakan oleh PHP:
Kebanyakan dari kode ini adalah HTML standar. Baris terakhir akan digunakan untuk membedakan
antara kode HTML dan PHP yang dihasilkan.
2. Pada jenis, baris berikutnya <?php sebagai tag awal php
3. Menambahkan print "Hello, World!"; Mencetak kalimat Hello, World! adalah langkah pertama referensi pemrograman. Meskipun alasan sepele untuk menggunakan PHP, Anda tidak benar-benar seorang programmer sampai Anda melakukan setidaknya satu Hello, World!
4. Tutup bagian PHP dan selesaikan halaman HTML:
?>
</ p>
</ body>
</ html>
5. Simpan file sebagai hello.php, lalu buka browser anda, tapi sebelum itu nyalakan aplikasi server di komputer anda.
MENAMBAHKAN KOMENTAR SCRIPT
Komentar merupakan bagian integral
dari pemrograman, bukan karena mereka melakukan apa pun tetapi karena mereka membantu Anda mengingat mengapa Anda melakukan sesuatu. Komputer mengabaikan komentar ini ketika script di proses.
Selain itu, komentar
PHP tidak pernah dikirim ke browser Web dan karena itu tetap rahasia Anda. PHP mendukung tiga
cara menambahkan komentar. Anda dapat berkomentar dengan menempatkan tanda / / atau # pada awal baris yang
ingin diabaikan, contoh : / / Ini adalah komentar.
Anda juga dapat menggunakan / / atau # untuk memulai komentar pada akhir baris PHP, seperti:
print "Halo"; / / Hanya ucapan.
Meskipun sebagian besar masalah gaya, / / adalah jauh lebih umum digunakan di PHP dari #.
Anda dapat komentar dari beberapa baris dengan menggunakan / * untuk memulai komentar dan * / untuk menyimpulkan itu:
/ * Ini adalah multi-baris komentar. * /
Beberapa programmer juga lebih suka jenis komentar ini karena mengandung tag pembuka dan penutup, untuk meberikan kapan komentar dimulai dan berakhir.
Anda juga dapat menggunakan / / atau # untuk memulai komentar pada akhir baris PHP, seperti:
print "Halo"; / / Hanya ucapan.
Meskipun sebagian besar masalah gaya, / / adalah jauh lebih umum digunakan di PHP dari #.
Anda dapat komentar dari beberapa baris dengan menggunakan / * untuk memulai komentar dan * / untuk menyimpulkan itu:
/ * Ini adalah multi-baris komentar. * /
Beberapa programmer juga lebih suka jenis komentar ini karena mengandung tag pembuka dan penutup, untuk meberikan kapan komentar dimulai dan berakhir.
Komentar
Posting Komentar