-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasses.php
More file actions
43 lines (42 loc) · 1.1 KB
/
classes.php
File metadata and controls
43 lines (42 loc) · 1.1 KB
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
class Task {
public $title;
public $desc;
public $status = false;
public function __construct($title, $desc) {
$this->title = $title;
$this->desc = $desc;
var_dump($desc);
}
public function complete() {
$this->status = true;
}
public function __destruct() {
echo "Desctructor invoked";
}
}
$task = new Task('Constructor', 'Automatically called whenever an object is created.');
// $task2 = new Task('Constructor2');
?>
<html>
<head>
<title>Classes</title>
</head>
<body>
<h2>
<?php
var_dump($task->desc);
// echo $task->desc;
var_dump($task->status);
$task->complete();
var_dump($task->status);
// var_dump($task2->desc);
// echo $task2->desc;
?>
</h2>
<hr>
<h3>Title: <?php echo $task->title; ?></h3>
<h3>Desc: <?php echo $task->desc; ?></h3>
</h1>
</body>
</html>