3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class BranchScheduleItem implements Serializable{ protected $title; protected $morning; protected $afternoon; public function serialize() { return serialize([ 'title' => $this->title, 'morning' => $this->morning, 'afternoon' => $this->afternoon, ]); } public function unserialize($serialized) { $data = unserialize($serialized); $this->title = $data['title']; $this->morning = $data['morning']; $this->afternoon = $data['afternoon']; } } $o = new BranchScheduleItem; $s = serialize($o); $a = unserialize($s); print_r($a); print_r($s);
based on VhjP9
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0alpha1
BranchScheduleItem Object ( [title:protected] => [morning:protected] => [afternoon:protected] => ) C:18:"BranchScheduleItem":54:{a:3:{s:5:"title";N;s:7:"morning";N;s:9:"afternoon";N;}}