This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+-------------------+------------------------+------------+ | |
| nama | alamat | nama_agama | | |
+-------------------+------------------------+------------+ | |
| Wahid Ashari | Jalan Pegangsaan Timur | Islam | | |
| Martin Natalegawa | Jalan Lingkar Luar | Kristen | | |
| Afika Notonegoro | Jalan Godean | NULL | | |
| Dahlan Iskandar | Jalan Tulip Semerbak | Budha | | |
| Afifah | Jalan Mawar Merah | Islam | | |
+-------------------+------------------------+------------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$belajar = function() { | |
echo "Nama saya Muhamad Ilham Arrouf"; | |
}; | |
$belajar(); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = 2; | |
$b = 16; | |
// Cara 1 | |
function cara1() { | |
global $a, $b; | |
$c = $a + $b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Contoh 1 | |
function perkalian ($x, $y, $z) | |
{ | |
$hasil = $x * $y * $z; | |
return $hasil; | |
} | |
echo perkalian(2, 2, 7); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function tampilkan($text, $angka) | |
{ | |
$saya = "Saya " . $text . " " . $angka; | |
echo $saya; | |
} | |
function jarak() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Penulisan fungsi | |
function namadepan() | |
{ | |
echo "Muhamad"; | |
} | |
function namatengah() | |
{ | |
echo "Ilham"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function NamaFungsi() // NamaFungsi merupakan nama fungsi yang anda tentukan sendiri | |
{ | |
kode yang akan di eksekusi; | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = saya; | |
switch ($a) { | |
case kamu : | |
echo "Angka Nol"; | |
break; | |
case dia : | |
echo "Angka Satu"; | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch ($var) { | |
case value1: | |
statement1; | |
break; | |
case value2: | |
statement2; | |
break; | |
case value3: | |
statement3; | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$x = 100; | |
/* Jika nilai $x di bawah ini sama dengan variabel $x yang telah dideklarasikan | |
maka akan mengeluarkan output false, begitu juga sebaliknya, Jika berbeda | |
makan akan mengeluarkan output true*/ | |
if ($x !== 90) { | |
echo "Hello world!"; | |
} | |
?> |