Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2012 19:33
Show Gist options
  • Select an option

  • Save anonymous/4270832 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/4270832 to your computer and use it in GitHub Desktop.
<?php
class ser extends stdClass implements Serializable {
var $prop;
public function __construct() {
$this->prop = "Property Value";
}
public function serialize() {
$obj = new stdClass();
$obj->prop = $this->prop;
return serialize($obj);
}
public function unserialize($data) {
}
}
$s = new ser();
var_dump(serialize($s));
// Output:
// string(67) "C:3:"ser":52:{O:8:"stdClass":1:{s:4:"prop";s:14:"Property Value";}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment