Reply to Re: how it works? pass a function as array(&$sess_handler, 'open') instead of '$sess_handler->open'

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация