-
Notifications
You must be signed in to change notification settings - Fork 2
/
Keyword.php
48 lines (44 loc) · 1.39 KB
/
Keyword.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
<?php
class UserController{
//static function
public static function generateUserID($accountId){
$userAccId = $accountId . '_2018';
return $userAccId;
}
//final function
final public function userName($userName){
$userName = $userName;
return $userName;
}
public function userDetails(){
$id = '10';
$userName = "Rafikul Islam Rafi";
$data = array(
'user_id' => self::generateUserID($id),
'user_name' => self::userName($userName)
);
return $data;
}
}
$userController = new UserController;
$ownValue = $userController->userDetails();
foreach($ownValue as $ownVal){
echo 'Own class value is: '. $ownVal.'<br>';
}
class AccountController extends UserController{
public function userNameDetails(){
$id = '15';
$userName = "Rafikul Islam";
$data = array(
'user_id' => UserController::generateUserID($id),
'user_name' => UserController::userName($userName)
);
return $data;
}
}
$accountController = new AccountController;
$extendValue = $accountController->userNameDetails();
foreach($extendValue as $exVal){
echo '<br>extend value is: '. $exVal;
}
?>