Hi,
I'm using serialize to save an object which worked until I started using Arrays in the class. Please see this code below:
class Base extends Tile
{
var $owner;
var $resources = Array();
function Base($owner)
{
$this->Tile();
$this->owner = $owner;
}
function __sleep()
{
// used this before which works for simple vars like owner
//return array('owner');
// trying this now but doesn't seem to work for arrays
return( array_keys( get_object_vars( &$this ) ) );
}
}
Then you would just call serialize and unserialize.
But like I commented that doesn't work, the array is not saved.
Any suggestions what could I try?
Thanks.