-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto_procedural_example.php
More file actions
43 lines (34 loc) · 930 Bytes
/
auto_procedural_example.php
File metadata and controls
43 lines (34 loc) · 930 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
<?php
require_once 'Automobile.php';
function pageController()
{
$data = [];
// objects are state and behavior
$ryanCar = new Automobile();
$ryanCar->setupAutomobile('hyundai', 'sonata', 'Ryan');
$ryanCar->speedUp(10);
$danielCar = new Automobile();
$danielCar->setupAutomobile('hyundai', 'sonata', 'Daniel');
$danielCar->speedUp(20);
$data['ryanCar'] = $ryanCar;
$data['danielCar'] = $danielCar;
return $data;
}
extract(pageController());
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<h1>Welcome to Automobile Race, yay!</h1>
<p><?php echo $ryanCar->speed; ?></p>
<p><?php echo $danielCar->speed; ?></p>
<p><?php echo $ryanCar->honk(); ?></p>
<p><?php echo $danielCar->screetchingHalt(); ?> </p>
</body>
</html>