3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Rowset implements Serializable { /** * @var array */ private $_results; public function __construct(array $results) { $this->_results = $results; } public function serialize() { return serialize($this->_results); } public function unserialize($serialized_data) { $this->_results = unserialize($serialized_data); } } class Item implements Serializable { const ITEM_TYPE_IMAGE = 'image'; const ITEM_TYPE_VIDEO = 'video'; /** * @var string */ protected $_service_name; /** * @var string */ protected $_item_id; /** * @var string */ protected $_item_url; /** * @var string */ protected $_user_id; /** * @var string */ protected $_text; /** * @var string */ protected $_post_url; /** * @var string */ protected $_item_type; /** * @var string */ protected $_datetime; /** * @param string $user_id * @return $this */ public function setUserId($user_id) { $this->_user_id = $user_id; return $this; } /** * @return string */ public function getUserId() { return $this->_user_id; } /** * @param string $datetime * @return $this */ public function setDatetime($datetime) { $this->_datetime = $datetime; return $this; } /** * @return string */ public function getDatetime() { return $this->_datetime; } /** * @param string $item_id * @return $this */ public function setItemId($item_id) { $this->_item_id = $item_id; return $this; } /** * @return string */ public function getItemId() { return $this->_item_id; } /** * @param string $item_type * @return $this */ public function setItemType($item_type) { $this->_item_type = $item_type; return $this; } /** * @return string */ public function getItemType() { return $this->_item_type; } /** * @param string $item_url * @return $this */ public function setItemUrl($item_url) { $this->_item_url = $item_url; return $this; } /** * @return string */ public function getItemUrl() { return $this->_item_url; } /** * @param string $post_url * @return $this */ public function setPostUrl($post_url) { $this->_post_url = $post_url; return $this; } /** * @return string */ public function getPostUrl() { return $this->_post_url; } /** * @return string */ public function getServiceName() { return $this->_service_name; } /** * @param string $text * @return $this */ public function setText($text) { $this->_text = $text; } /** * @return string */ public function getText() { return $this->_text; } public function serialize() { return serialize($this->_datetime); } public function unserialize($serialized_data) { } } $item = new Item(); $item->setText('yoyo'); $rowset = new Rowset(array($item)); echo serialize($rowset);
based on tOHSI
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
C:6:"Rowset":27:{a:1:{i:0;C:4:"Item":2:{N;}}}
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/Unimd on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting '{' in /in/Unimd on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting '{' in /in/Unimd on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'{'' in /in/Unimd on line 3
Process exited with code 255.