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