-
Notifications
You must be signed in to change notification settings - Fork 0
/
oop.php
37 lines (25 loc) · 797 Bytes
/
oop.php
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
<?php
class cars {
// public $doors;
// public $color;
// public $year;
// public $name;
public function __construct($a, $b, $c, $d){
$this->name = $a;
$this->year = $b;
$this->color = $c;
$this->doors = $d;
}
public function st(){
echo $this->name . '<br/>' . $this->year . '<br/>' . $this->size . '<br/>' . $this->color . '<br/>' . '<br/>';
}
}
$kiaOptima = new cars ('Kia Optima', 2004, 'Tan', 4);
$fordExplorer = new cars ('Ford Explorer', 2013, 'Red', 6);
$kiaOptima->st();
$fordExplorer->st();
// echo $kiaOptima->name . '<br/>';
// echo $kiaOptima->size;
print_r($kiaOptima);
print_r($fordExplorer);
?>