-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting.php
More file actions
executable file
·172 lines (155 loc) · 3.42 KB
/
testing.php
File metadata and controls
executable file
·172 lines (155 loc) · 3.42 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
//** pemahaman method dan property */
// interface Kegiatan {
// public function Makan();
// public function Minum();
// }
//
// class Manusia implements Kegiatan{
// public $nama;
// public $tgl_lahir;
// protected $gender;
// private $status;
//
// public function Makan(){
// return ''.$this->nama.' Butuh Makan';
// }
//
// public function Minum(){
// return ''.$this->nama.' Butuh Minum';
// }
// }
//
// class Pria extends Manusia {
//
// public function __construct($nama,$tgl_lahir,$gender){
// $this->nama = $nama;
// $this->tgl_lahir = $tgl_lahir;
// $this->gender = $gender;
// }
//
// public function isStatus($the_status){
// return $this->status = $the_status;
// }
//
// public function Gender($gendernya){
// return $this->gender = $gendernya;
// }
//
// public function dataDiri(){
// return [
// "name" => $this->nama,
// "gender" => $this->gender,
// "tgl_lahir" => $this->tgl_lahir,
// "status" => $this->status,
// "Makankah?" => $this->Makan(),
// "Minumkah?" => $this->Minum(),
// ];
// }
// }
//
//
// $saya = new Pria('asep','01-02-91','prias');
// // echo $saya->Gender('Pria');
// // echo '</br>';
// // echo $saya->nama = 'Jono';
// // echo '</br>';
// // echo $saya->tgl_lahir = '05-06-83';
// // echo '</br>';
// $saya->status = 'jomblo';
//
// echo '<pre>';
// print_r($saya->dataDiri());
// // print_r($saya->isStatus('Jomblo'));
//
//
// function Xors($arr,$n){
// $xor = 0;
// for($i = 0; $i <$n; $i++){
// $xor = $xor ^ $arr[$i];
// }
// return $xor * $n;
// }
// $arr = array(9, 3, 2);
// $n = count($arr);
// echo Xors($arr,$n);
//
// $arr = array(1,3,5);
// $arr2 = array(2,4);
// $temp = [];
// for($i = 0; $i < count($arr); $i++){
// $temp[] = $arr[$i];
// $temp[] = $arr2[$i];
// }
// echo'<pre>';
// print_r($temp);
/**
*
*/
class ClassController extends CI_Controller
{
function __construct()
{
// code...
$mydb = $this->db = 'default';
}
public function index(){
}
}
Class Manusia {
private $lari;
public function __construct(){
$this->lari = $fungsi;
}
public function Jalan(){
return 'Bisa Jalan'.$this->lari;
}
public function Makan(){
return 'Makan';
}
}
Class Pria extends Manusia{
public function Activity(){
return $this->Jalan().' - '.$this->lari;
}
}
$test = new Pria('off');
$tes = $test->Activity();
echo $tes;
// echo $test->lari ='off';
?>
<script>
class Car {
constructor(type,color,status){
this.type = type;
this._color = null;
this.engineStatus = status;
}
get color () {
return `Warna Mobilnya adalah ${this._color}`
}
set color (color) {
this._color = `${color} keren`
}
_isEngineOn(){
this.engineStatus = 'on';
console.log('Mesin ON');
}
_isEngineOff(){
this.engineStatus = 'off';
console.log('Mesin OFF');
}
static isEngineStart(state){
if(state.engineStatus == 'on'){
return 'Mesin Nyalah';
}
else{
return 'Mesin Mati';
}
}
}
const FetchClass = new Car('E-Cvt','White','on');
console.log(FetchClass);
// console.log(Car.isEngineStart(FetchClass));
console.log(FetchClass.color = 'red');
</script>