-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDogClass.php
More file actions
49 lines (35 loc) · 944 Bytes
/
DogClass.php
File metadata and controls
49 lines (35 loc) · 944 Bytes
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
<?php
class DogClass {
private $color;
private $eyeColor;
private $height;
private $length;
public $weight;
function __construct(String $color, String $eyeColor, int $height, int $length, int $weight) {
$this -> color = $color;
$this -> eyeColor = $eyeColor;
$this -> height = $height;
$this -> length = $length;
$this -> weight = $weight;
}
function __destruct() {
}
/*
function __sleep() {
return ['color', 'eyeColor', 'weight'];
}
public function __wakeup() {
echo 'Uyandım :) ';
$this -> showMyWeight();
}
*/
function showMyWeight() {
echo 'Benim şuanki kilom, ' . $this -> weight.'<br>';
}
}
$dogDuman = new DogClass('Açık Gri', 'Siyah', 60, 155, 24);
$serDogDumanStr = serialize($dogDuman);
file_put_contents('DogDuman.ser', $serDogDumanStr);
$serDogDumanStr = file_get_contents('DogDuman.ser');
$unSerDogDuman = unserialize($serDogDumanStr);
echo $unSerDogDuman -> showMyWeight();