tags:

views:

24

answers:

2

Hello,

I have a Session class that has all my on_session_write, on_session_read etc. methods inside the class. In my constructor function i have it initiate the

session_set_save_handler("on_session_start",   "on_session_end",
        "on_session_read",    "on_session_write",
        "on_session_destroy", "on_session_gc");

and also session_start() within this my only problem is the methods need to be called using $this-> because everything is within the class. How do i accomplish this?

+3  A: 

It's very simple:

array($this,'methodName'); 

That's a callback to a method.

array('className','methodName');

That's a callback to a static method.

Evert
Thanks will try this out
William Smith
+1  A: 

You can pass array($this, 'methodName') as an argument. Read more on http://php.net/manual/en/language.pseudo-types.php

reko_t
Thanks for the link
William Smith