here is a sample code of a class. I used a trick from one of the articles here.
when i try $sess->register("person"); (person is an instance of Person) everithig is ok, but the next time the script is ran, the PHPLIB fails to load the serialized object.
My guess is that the serialize function in PHPLIB doesn't understend my constructor, i think it generates some code like
$person = new Person; but the problem is that the constructor myst get some parameters.
do u have any ideas on how to overcome this problem (it would be nice if i could use the constructor overloading)
PS: sorry for code identing
class Person {
var $classname = "Person";
/Class constructor. It uses a trick so that we can use constructor overloading/
function Person() {
$name="Person_".func_num_args();
$arg_list = func_get_args();
$num_args = func_num_args();
switch($num_args) {
case 1:
$this->$name($arg_list[0]);
break;
default:
echo "Wrong number of parameters on ".get_class($this)." constructor!";
}
}
/*This is the actual constructor for the class that will be called when a operator will login*/
function Person_1($personID) {
//some code
}
}