- serialize: documentation ( source)
- json_encode: documentation ( source)
<?php
class A{
public $test = "toto";
private $tesaegaegt = "togaegegto";
public function jsencode(){
return json_encode(serialize($this));
}
}
$a = new A();
echo serialize($a);