/
interview3.php
60 lines (38 loc) · 1.16 KB
/
interview3.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
class Vehicle {
public $doors;
public $color;
public $tires;
public function __construct($doors,$color,$tires) {
$this->tires = $tires;
$this->color = $color;
$this->doors = $doors;
}
public function getData() {
return "this car has " . $this->tires . " tires, the cars color is " . $this->color . " and the car has " . $this->doors . " doors on it as well.";
}
}
$mycar = "";
$mycar = new Vehicle(2,"white",4);
$mycar->getData();
class Car extends Vehicle {
public $make;
public $model;
public function __construct($doors,$color,$tires,$make,$model) {
parent::__construct($doors,$color,$tires);
$this->make = $make;
$this->model = $model;
// $this->tires = $tires;
// $this->color = $color;
// $this->doors = $doors;
}
}
$mycar = new Car(2,"white",4,"Ford","Mustang");
// $mycar->getData();
print_r($mycar);
function foo() {
$x = 27;
$y = 32;
$ans = $x + $y;
}
echo gettype(foo());