|
Posted by Janwillem Borleffs on 04/17/06 14:32
_Mario.lat wrote:
> How does it works?
> why it use "array(&$sess_handler, 'open')" and not
> "$sess_handler->open" ? How "array(&$sess_handler, 'open')" works?
>
You should read this as array(reference_to_object, object_method_to_call);
In this case, when the session starts, the 'open' method within the
$sess_handler object instance is called with $savePath and $sessName as its
arguments. Where $sess_handler->open is a property call, the passing of the
array containing the object instance and the method (handler) name, only
sets up the specific session handler for later usage.
BTW, there are other functions using the same scheme, like call_user_func:
class Foo {
function Bar($name) {
print "Hello $name";
}
}
call_user_func(array(new Foo, 'Bar'), 'John');
HTH;
JW
[Back to original message]
|