Last active
June 26, 2019 12:50
-
-
Save AliN11/ac9dfe59e1caa13f63effb8e0bfcd446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Room | |
{ | |
private $color = 'white'; | |
private $size = 'xl'; | |
public function setColor(string $color): void | |
{ | |
$this->color = $color; | |
} | |
public function getColor(): string | |
{ | |
return $this->color; | |
} | |
} | |
$room = new Room; | |
$room->setColor('Blue'); | |
$serialized = serialize($room); | |
$unserialized = unserialize($serialized); | |
echo $unserialized->getColor(); // Blue | |
// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment