- json_encode: documentation ( source)
<?php
class C implements JsonSerializable {
var $a = 'lol';
var $b = 'fa';
public function jsonSerialize() {
$aux = clone($this);
return $aux;
unset($aux->a);
return $aux;
}
}
echo json_encode(new C());