How to call non static method from static method in PHP?

If the instance of your class is rarely needed, you can have the static method create an instance, call the non-static method and return the value.

class Scope {
 public function mynonstatic() {
 }
 public static function mystatic() {
 $s = new Scope();
 return $s->mynonstatic();
 }
 }
 

Leave a Comment

Your email address will not be published. Required fields are marked *