@ 2014-09-11T19:12:52Z <?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);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Deprecated: Rowset implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/Unimd on line 3
Deprecated: Item implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/Unimd on line 27
C:6:"Rowset":27:{a:1:{i:0;C:4:"Item":2:{N;}}} Output for 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.8 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.25 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 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.3.11 , 4.4.0 - 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 . preferences:dark mode live preview
223.67 ms | 401 KiB | 327 Q