oop - Do not want to instantiate objects in php classes -


can have static classes in php ? dont want instantiate class, there possible way of doing have in java , c# ?

no, cannot declare class static in php, @ least not aware of that. but, can declare functions in class static.

you can declare constructor private prevent class getting instantiated, , prevent class being inherited declare class final.

final class myclass   private function __construct() {     // cannot instantiate class   }    public static function mystaticfunction() {     // static function   } } 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -