Answer the question
In order to leave comments, you need to log in
How to call non-static methods or properties from a static method?
for example
class Dream
{
private $mydream;
private $findDream;
public static function whichDream()
{
//Here
}
public function findDream()
{
// SOmething......
}
}
Answer the question
In order to leave comments, you need to log in
As an option
class Dream
{
private $mydream;
private $findDream;
private static $self = null;
public static function _self()
{
if(is_null(self::$self)) {
self::$self = new self;
}
return self::$self;
}
public static function whichDream()
{
return self::_self()->findDream();
}
public function findDream()
{
echo 'Test';
}
}
Dream::whichDream();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question