<?php
class myClass{
public function myMethod(){// this will be lost when JSON encoding //
echo 'Hello there!';
}
}
$x = array('a'=>1, 'b'=>2);
$y = new myClass;
$y->a = 1;
$y->b = 2;
echo json_encode($x), "\n", json_encode($y); // identical
echo "\n", serialize($x), "\n", serialize($y); // not identical
?>