1 / 10

ARRAY, Date & Conditional Function

www.achmadharir.com. ARRAY, Date & Conditional Function. Variabel hanya bisa menampung sebuah nilai , tetapi bagaimana jika kita memiliki banyak nilai yang harus di deskripsikan pada variable yang sama ?

rolf
Télécharger la présentation

ARRAY, Date & Conditional Function

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. www.achmadharir.com ARRAY, Date & Conditional Function

  2. Variabelhanyabisamenampungsebuahnilai, tetapibagaimanajikakitamemilikibanyaknilai yang harus di deskripsikanpada variable yang sama? Untukkasusinikitamemerlukanvariabel array. Yaituvariabel yang mampumenyimpannilailebihdarisatu Contoh : $mobil1 = “Toyota”; $mobil2 = “Nissan”; $mobil3 = “Honda”; Variabel Array www.achmadharir.com

  3. DenganVariabel Array makamenjadi : $mobil = array(“Toyota”,”Nissan”,”Honda”); Makauntukmemanggilnyakitamenggunakanindeksdimulaidari 0 Echo $mobil[0]; Echo $mobil[1]; Echo $mobil[2]; Variabel Array www.achmadharir.com

  4. Function date() adalah function untukmengambiltanggaldanwaktuberdasarkan server. Format function date adalah : date(“format”) Contoh : $waktu = date(“dmy”); Makahasilnyaadalah111011  d = 11 m = 10 y = 11 Atau$waktu = date(“d/m/y”); Makahasilnyaadalah11/10/11 DATE Function www.achmadharir.com

  5. Format Lain nya : Day DATE Function www.achmadharir.com

  6. Format Lain nya : Month DATE Function www.achmadharir.com

  7. Format Lain nya : Year Week DATE Function www.achmadharir.com

  8. Format Lain nya : Time DATE Function www.achmadharir.com

  9. FungsiKondisibergunajikakitamenemukansuatupilihan yang harusdipilih. Dipastikanseluruhbahasapemogramanmenggunakanfungsiini. <?php if (condition) { …… jikaterpenuhi ……} else { …… jikatidakterpenuhi ……} ?> CONDITIONAL Function www.achmadharir.com

  10. Contoh : <?php $a = date(“Y”); if ($a==“2011”) { echo “Benar”; } else { echo “Salah”; } ?> CONDITIONAL Function www.achmadharir.com

More Related