- var_dump: documentation ( source)
- unserialize: documentation ( source)
- serialize: documentation ( source)
<?php
class niet {
public $one;
public $two;
protected $three;
protected $four;
public function __construct() {
$this->one = "1";
$this->two = "2";
$this->three = "3";
$this->four = "4";
}
public function getData() {
return [$this->one, $this->two, $this->three, $this->four];
}
}
class wel extends niet implements Serializable {
public function serialize() {
return serialize($this->getData());
}
public function unserialize($data) {
list($this->one, $this->two, $this->three, $this->four) = unserialize($data);
}
}
$niet = new niet;
$niet = serialize($niet);
$wel = new wel;
$wel = serialize($wel);
var_dump($niet, $wel);
$niet = unserialize($niet);
$wel = unserialize($wel);
var_dump($niet->getData(), $wel->getData());
?>