Entry
If I use session_register($object), the class is rewrite to stdClass, and no methods will be avaible. How can I solve this problem?
Jul 31st, 2000 15:54
Ben Udall, Tomas V.V.Cox,
Below is a function you can use to move all of an objects properties to
another class.
function convert_obj($old_obj, $class_name)
{
$obj_props = $old_obj;
settype($obj_props, 'array');
$new_obj = new $class_name;
for (reset($obj_props); $key = key($obj_props); next($obj_props))
$new_obj->$key = $obj_props[$key];
return $new_obj;
}