jeudi 9 avril 2015

How to access to non-static method from static in PHP


Vote count:

0




Have a Class



class SomeClass1{
public static function myStatic($arg){
return (new SomeClass1)->myMethod($arg);
}

public function myMethod($arg){
return $arg;
}
}

var_dump((SomeClass1::myStatic('123')));


I really do not like this part



(new SomeClass1)->myMethod($arg);


Are there any other ways?



asked 1 min ago







How to access to non-static method from static in PHP

Aucun commentaire:

Enregistrer un commentaire