-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
54 lines (43 loc) · 1.38 KB
/
functions.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
<?php
class Account {
public $name;
public $balance;
public $accNum;
public function __construct($name, $balance, $accNum) {
$this->name = $name;
$this->balance = $balance;
$this->accNum = $accNum;
}
// show balance
public function showBal() {
return $this->balance;
}
public function showPIN() {
return $this->accNum;
}
// withdraw
public function withdraw($amount) {
if($this->balance > 0) {
if($amount <= $this->balance) {
$this->balance -= $amount;
echo "You have Succesfully Withdrawn!<br><br>";
echo "You current balance is : <b>₱ " ;
} else {
echo "Error: Insufficient funds";
echo "<br>";
echo "You current balance is : <b>₱ " ;
}
} else {
echo "Error: Insufficient funds";
echo "<br>";
echo "You current balance is : <b>₱";
}
}
public function deposit($amount) {
$this->balance += $amount;
}
}
// accounts
$person1 = new Account("RA", 200, 1234);
$person2 = new Account("Kim", 1000, 6789);
?>