Skip to content

Instantly share code, notes, and snippets.

@AliN11
Last active June 26, 2019 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AliN11/ac9dfe59e1caa13f63effb8e0bfcd446 to your computer and use it in GitHub Desktop.
Save AliN11/ac9dfe59e1caa13f63effb8e0bfcd446 to your computer and use it in GitHub Desktop.
<?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