Last active
January 28, 2017 14:42
-
-
Save inuvalogic/1c76d448d1c9e1598cb40f03074a616c to your computer and use it in GitHub Desktop.
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Web PHP Pertama Saya</title> | |
</head> | |
<body> | |
<?php | |
echo "Web PHP Pertama Saya"; | |
print "Hore saya bisa"; | |
?> | |
<?= "Halo Halo Bandung"; ?> | |
</body> | |
</html> |
This file contains 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 | |
$string = "ini sebuah var string"; | |
$string_alternatif = 'ini sebuah var string'; | |
$integer = 1800; | |
$float = 1.5; | |
$boolean = true; | |
$array = array(1,2,3,4); | |
$array_alternatif = [1,2,3,4]; | |
$null = NULL; | |
$null_alternatif = null; | |
$empty_string = ''; |
This file contains 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 | |
// Penambahan | |
$z = $x + $y; | |
// Pengurangan | |
$z = $x - $y; | |
// Perkalian | |
$z = $x * $y; | |
// Pembagian | |
$z = $x / $y; | |
// Modulus | |
$z = $x % $y; | |
// Eksponen | |
$z = $x ** $y; | |
$x = 10; | |
$y = 5; | |
$z = ((($x%2 + $y)/$y)*$x**2); | |
echo $z; |
This file contains 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 = 10; | |
if ($a==10){ | |
echo "A sama dengan sepuluh"; | |
} | |
$a = 11; | |
if ($a==10){ | |
echo "A sama dengan sepuluh"; | |
} else { | |
echo "A bukan sepuluh tapi ".$a; | |
} | |
$kitty = "kucing"; | |
if ($kitty!="kucing") { | |
echo "Kitty itu bukan kucing tapi boneka"; | |
} else { | |
echo "Kitty itu seekor kucing"; | |
} |
This file contains 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 = 10; | |
switch ($a) { | |
case 10: | |
echo "aku muncul karena A itu sepuluh"; | |
break; | |
case "kucing": | |
echo "aku muncul karena A itu seekor kucing"; | |
break; | |
default: | |
echo "apapun nilai A aku yang muncul"; | |
break; | |
} |
This file contains 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
<form method="post"> | |
<div> | |
<label for="judul">Judul</label> | |
<input type="text" name="judul"> | |
</div> | |
<div> | |
<label for="isi">Isi</label> | |
<textarea name="isi"></textarea> | |
</div> | |
<button type="submit" name="submit">Tambah</button> | |
</form> | |
<?php | |
if (isset($_POST['submit'])) | |
{ | |
$judul = $_POST['judul']; | |
$isi = $_POST['isi']; | |
echo "Judul = ".$judul."<br>Isi = ".$isi; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment