<html lang="en">
<head>
<meta charset="UTF-8">
<title>test php2</title>
</head>
<body>
<?php
$x =1000;
$y = "toro";
$z = 123.231;
$anArray = ["toro",1,2,3,4];
$booleans = true;
$kosong = null;
//object
class Human {
function Human(){
$this -> nama = "toro"; // set constructor
}
}
// var dump => me return tipe dan value dari sebuah variabel.
var_dump($x); // int 1000
var_dump($y); // string 'toro' (length=4)
var_dump($z); // float 123.231
var_dump($anArray);
//array (size=5)
0 => string 'toro' (length=4) 1 => int 1 2 => int 2 3 => int 3 4 => int 4
var_dump($booleans); //boolean true
var_dump($kosong); //null
//test object
$human = new Human();
echo $human -> nama; //toro
?>
</body>
</html>
No comments:
Post a Comment