Hi guys

I have been going through some piece of code and got confused at a certain point. The below is a piece of code:

PHP Code:
class DataManager
{
  private static function 
_connect()
  {
    return new 
PDO('mysql:host=localhost;dbname=sample''root','');
  }

  public static function 
fetch_users()
  {
    
$db self::_connect();

    
$st $db->query("SELECT * FROM users");
    
//....
  
}
  
  public static function 
func2()
  {
    
$db self::_connect();

    
$st $db->query("SELECT * FROM users");
    
//....
  
}

  public static function 
func2()
  {
    
$db self::_connect();

    
$st $db->query("SELECT * FROM users");
    
//....
  
}
  
  
//and so on..

Isn't that a bad practice ? I mean, each time when a member function is executed, the connect() function is called which will return a NEW PDO object. So, new PDO objects are created each time.

Am I correct ?

Thanks