We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e951dd3 commit ea5d772Copy full SHA for ea5d772
4-pengenalan-konstruk.php
@@ -0,0 +1,27 @@
1
+<?php
2
+
3
+class ContohClass {
4
+ public $data1;
5
+ public $data2;
6
+ public function __construct($__data1, $__data2)
7
+ {
8
+ $this->data1 = $__data1;
9
+ $this->data2 = $__data2;
10
+ $this->tampilkanDataLewat__construct();
11
+ }
12
13
+ protected function tampilkanDataLewat__construct() {
14
+ echo 'Fungsi yang di panggil pada saat Objek dibuat: '.$this->data1.' '.$this->data2."\n";
15
16
17
+ public function tampilkanData() {
18
+ echo $this->data1.' '.$this->data2."\n";
19
20
+}
21
22
+$CONTOHCLASS = new ContohClass('satu', 2);
23
+echo "+++++++++++++++++++++++++++++++++++++\n";
24
+sleep(5);
25
+for ($i=0; $i < 5; $i++) {
26
+ $CONTOHCLASS->tampilkanData();
27
0 commit comments