<body> <?php echo "Hello world" . "<br>"; $x = 5 + 5; echo $x . "<br>"; $color = " red "; echo "my car is" . $color . "<br>"; echo "my house is" . $color . "<br>"; echo "my boat is" . $color . "<br>"; $txt = "ftikom"; echo "I'am {$txt}" . "<br>"; $x = 5; $y = 4; echo $x + $y . "<br>"; function writeMsg() { echo "Hello World" . "<br>"; } writeMsg(); function familyname($fname) { echo "{$fname} ftik" . "<br>"; } familyname("susi"); familyname("agus"); familyname("dian"); ?> </body> </html>
<!DOCTYPE html> <html> <body> <?php function writeMSG() { echo "Hello World" . "<br>"; } echo "HELLO BONTANG" . "<br>" . "<br>"; function familyname($fname) { echo "{$fname} Saun" . "<br>"; } familyname("Agus Winarto"); familyname("Iwan Prastyo"); familyname("Lia Andriyani"); echo "<br>" . "<br>"; function setHeight($minheight = 50) { echo "The height is :{$minheight} <br>"; } setHeight(350); setHeight(350); // willl use default value of 50 setHeight(135); setHeight(80); echo "<br>" . "<br>"; function sum($x, $y) { $z = $x + $y; return $z;
$x = 5; $y = 4; echo "my car is " . $color . "<br>"; echo "jumlahnya ada " . $jumlah . "<br>"; echo "beli di {$toko} <br>"; echo "{$x} + {$y} <br>"; echo strlen("Hello Dunia"); //outputs 11 echo "<br>"; echo str_word_count("Hello Dunia Luar"); //outputs 3 echo "<br>"; echo strrev("kilabret kadit"); echo "<br>"; echo strpos("Hello world", "world"); echo "<br>"; echo str_replace("Dunia", "Dolly", "Hello Dunia"); echo "<br>"; pesan(); familyname("<br> Gunting", "1996"); familyname("Batu", "1945"); familyname("kertas", "2000"); setheight(500); setheight(); setheight(90); echo "5 + 10 = " . sum(5, 10) . "<br>"; echo "7 + 2 = " . sum(7, 2) . "<br>"; echo "12 + 3 = " . sum(12, 3) . "<br>"; ?> </body> </html>
<title></title> <body> <?php echo "Hello sayang" . "<br>"; $x = 5 + 5; echo $x . "<br>"; $color = " biru "; echo "mobilku" . $color . "<br>"; echo "motorku" . $color . "<br>"; echo "rumahku" . $color . "<br>"; $txt = "FTIK"; echo "saya kuliah di {$txt}" . "<br>"; $x = 5; $y = 4; echo $x + $y . "<br>"; function writeMsg() { echo "Hello Brow" . "<br>"; } writeMsg(); function familyname($fname) { echo "{$fname} cantip" . "<br>"; } familyname("safril"); familyname("indra"); ?> </body> </html>
echo str_word_count("Saya tinggal di Jl.P.Bendahara ") . "<br>"; echo "Kalimat ( Kasur ini rusak ) jika di balik akan menjadi = "; echo strrev(" rusak ini kasur") . "<br>"; echo strpos("Mohammad Yasin", "Yasin") . "<br>"; echo str_replace("Guys", "All", "Hay Guys My Name is Mohammad Yasin") . "<br>"; function writeMsg() { echo "Hay Guys " . "<br>"; } function familyname($fname, $day, $month, $year) { echo "{$fname} FTIK Born in {$day} {$month} {$year} <br>"; } familyname("Mohammad Yasin kuliah di Fakultas", "19", "Juli", "1996"); familyname("Babul Arziqul kuliah di Fakultas", "7", "Oktober", "1995"); familyname("Muhamad Eri kuliah di Fakultas", "11", "Februari", "1996") . "<br>"; echo "<br>"; function warna($warnakesukaan = "Red") { echo "Warna kesukaan Anda adalah : {$warnakesukaan} <br>"; } warna("Blue"); warna("Black"); warna(); warna("White"); warna("Green"); function sum($x, $y) { $z = $x + $y; return $z; }
<?php /** * Created by PhpStorm. * User: root * Date: 14/11/2015 * Time: 15:49 */ function familyname($fname) { echo "{$fname} Hello!!<br>"; } function conghaiso($a, $b) { echo "Ket qua:" . ($a + $b) . "<br>"; } $arr = array("Tinh", "Tu", "Linh"); $arr1 = array("Tinh" => "35", "Tu" => "20", "Linh" => "40"); echo "Tinh tuoi: " . $arr1['Tinh'] . "<br>"; familyname("Tinh"); familyname("Hanh"); familyname("Tu"); conghaiso(5, 6); for ($i = 0; $i < count($arr); $i++) { echo "Ten: " . $arr[$i] . "<br>"; } foreach ($arr1 as $x => $x_value) { echo "Key = " . $x . " Value = " . $x_value . "<br>"; } echo $_SERVER["PHP_SELF"];
<?php // function with arguments echo "<h1>Functions With Arguments</h1>"; echo "<h3>Example One</h3>"; function familyName($fname) { echo "<p>{$fname} saeed</p>"; } familyname("Asim"); familyname("Yasir"); familyname("Sadia"); familyname("Umair"); familyname("Hadi"); echo "<h3>Example Two</h3>"; function info($name, $age) { echo "<p>Your name is {$name}. <br> And your age is {$age}.</p>"; } info("hadi", 22); info("Ali", 20); echo "<h3>Example Three</h3>"; function info1($name, $age, $sex = "male") { echo "<p>Your name is {$name}. <br> And your age is {$age}.<br>Gender is {$sex}</p>"; } info1("Hadi", 22, "Male"); info1("Huda", "21", "female"); info1("Ali", 20);
<!DOCTYPE html> <html> <body> <?php function writeMSG() { echo "Hello World" . "<br>"; } echo "HALLO BULUNGAN" . "<br>" . "<br>"; function familyname($fname) { echo "{$fname} Saputri" . "<br>"; } familyname("Susi"); familyname("Anita"); familyname("Tiara"); echo "<br>" . "<br>"; function setHeight($minheight = 50) { echo "The height is :{$minheight} <br>"; } setHeight(350); setHeight(350); // willl use default value of 50 setHeight(135); setHeight(80); echo "<br>" . "<br>"; function sum($x, $y) { $z = $x + $y; return $z;
echo str_word_count("Saya tinggal di Jl.Damai Gg.WIA Sejahtera ") . "<br>"; echo "Kalimat ( Kasur ini rusak ) jika di balik akan menjadi = "; echo strrev(" kasur ini rusak") . "<br>"; echo strpos("Abdullah Hanif", "Hanif") . "<br>"; echo str_replace("Guys", "All", "Hay Guys My Name is Abdullah Hanif") . "<br>"; function writeMsg() { echo "Hay Guys " . "<br>"; } function familyname($fname, $day, $month, $year) { echo "{$fname} FTIK Born in {$day} {$month} {$year} <br>"; } familyname("Abdullah Hanif kuliah di Fakultas", "02", "November", "1996"); familyname("Suges Pramana kuliah di Fakultas", "27", "Juli", "1995"); familyname("Wong Richard kuliah di Fakultas", "22", "Februari", "1996") . "<br>"; echo "<br>"; function warna($warnakesukaan = "Red") { echo "Warna kesukaan Anda adalah : {$warnakesukaan} <br>"; } warna("Blue"); warna("Black"); warna(); warna("White"); warna("Green"); function sum($x, $y) { $z = $x + $y; return $z; }