I am new to php and had to work with an existing code base. In this library there is a class which deals with the mysql database. However, they start to instantiate an object with a 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 the advantage of this static function in comparison to an usual constructor. How do I have to deal with my login credentials? Do I have to make them static, too?