-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_type.php
More file actions
51 lines (45 loc) · 853 Bytes
/
data_type.php
File metadata and controls
51 lines (45 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
print '<br />';
print 'The result are ' . $y;
echo '<br />';
$string = 'Halo Mamang';
$integer = 5;
$float = 0.5;
$boolean = false || true;
$array = array('Andri', 'Subekti', ' Yadi');
$object = [
'name' => 'asiap',
'age' => 5,
];
class Car
{
public
$color,
$model,
$year;
public function __construct(string $color, string $model, int $year)
{
$this->color = $color;
$this->model = $model;
$this->year = $year;
}
public function printColor()
{
echo '<br />', $this->color;
}
}
var_dump($string);
echo '<br />';
var_dump($integer);
echo '<br />';
var_dump($float);
echo '<br />';
var_dump($boolean);
echo '<br />';
var_dump($array);
echo '<br />';
var_dump($object['name']);
echo '<br />';
var_dump(new Car('red', 'tesla', 2022));
$tesla = new Car('green', 'tesla', 2010);
$tesla->printColor();