php - Constructor vs static instance -
i new php , had work existing code base. in library there class deals mysql database. however, start instantiate object static getinstance function:
public static function get_instance() { if(null == self::$instance) { $c = __class__; self::$instance = new $c(); } return self::$instance; }
i don't see advantage of static function in comparison usual constructor. how have deal login credentials? have make them static, too?
Comments
Post a Comment