How to return Current Object in a Static function in PHP
Posted
by streetparade
on Stack Overflow
See other posts from Stack Overflow
or by streetparade
Published on 2010-04-07T17:50:30Z
Indexed on
2010/04/07
17:53 UTC
Read the original article
Hit count: 322
I neet access to current object in a static method.
Code:
protected static $name;
public static function name($modulename)
{
self::$name = $modulename;
}
public function __call($name, $arguments)
{
$me = new test(self::$name);
return $me->$name($arguments);
}
I want to be able to call method log in Log class. Like this
echo Mods::name("Log")->log("test")
;
How do i do that?
© Stack Overflow or respective owner