-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsclass1.php
More file actions
56 lines (50 loc) · 1.1 KB
/
sclass1.php
File metadata and controls
56 lines (50 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
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
class Student {
public $id;
public $firstname;
public $lastname;
public $emailaddres;
function _setid($id) {
$this->id = $id;
}
function _getid() {
return $this->id;
}
function _setfirstname($firstname) {
$this->firstname= $firstname;
}
function _setlastname($lastname) {
$this->lastname = $lastname;
}
function _setemailaddress($emailaddress) {
$this->emailaddress = $emailaddress;
}
function _getemailaddress() {
return $this->emailaddress;
}
function _getFullName(){
return "$this->firstname, $this->lastname";
}
}
$lee = new Student();
$lee->_setid(1);
$lee-> _setfirstname('Lee');
$lee->_setlastname('Cox');
$lee->_setemailaddress('leecox@kingsuni.ac.uk');
echo $lee->_getid();
echo "<br>";
echo $lee->_getFullName();
echo "</br>";
echo $lee->_getemailaddress();
echo "<br>";
$matt = new Student();
$matt->_setid(2);
$matt-> _setfirstname('Matt');
$matt->_setlastname('Bond');
$matt->_setemailaddress('mattbond@kingsuni.ac.uk');
echo $matt->_getid();
echo "<br>";
echo $matt->_getFullName();
echo "</br>";
echo $matt->_getemailaddress();
?>