[RESOLVED] session_set_save_handler in a class syntax .....

liunx

Guest
Hi.
Could anybody explain me this syntax, please ?

public function setHandler()
{
session_set_save_handler(array($this,'openSession'),array($this,'closeSession'),array($this,'readSession'),array($this,'writeSession'),array($this,'destroySession'),array($this,'gcSession'));
}



Thanks in advance.


Bye.Functions that you pass a callback function name to, you can usually make them call an object instance and method by passing an array in the form array($object, 'method').

example:
// call $my_object->my_method();
call_user_func(array($my_object, 'my_method'));

You can even do static calls on callbacks by passing array('class', 'method'). Example:
// call my_class::my_method();
call_user_func(array('my_class', 'my_method'));

And of course, setting a callback as a function:
// call my_function();
call_user_func('my_function');

Not sure if I explained that well enough, but I hope it helps. :-)Thanks so much buddy for the enlightenment ;)

Bye.
 
Back
Top