PHP - PDO OOP MySQL database connection is being repeated, is that a normal behavior? : <p>I am using a class for db connection like this...</p>

<pre><code>class Dbh
{
    private $host;
    private $dbName;
    private $password;
    private $dbUser;
    private $charset;

    protected function connect ()
    {
        $this-&gt;host = 'localhost';
        $this-&gt;dbName = 'test';
        $this-&gt;password = '';
        $this-&gt;dbUser = 'root';
        $this-&gt;charset = 'utf8mb4';
        try
        {
            $dsn = 'mysql:host=' . $this-&gt;host . ';dbname=' . $this-&gt;dbName . ';charset=' . $this-&gt;charset;
            $pdo = new PDO($dsn, $this-&gt;dbUser, $this-&gt;password);
            $pdo-&gt;setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
            return $pdo;
        }
        catch (PDOException $exception)
        {
            $message = 'Connection failed:' . $exception-&gt;getMessage();
            return $message;
        }
    }

}
</code></pre>

<p>... Now what worries me if I echo in <code>try</code> for example <code>echo 'Connected';</code> and call for example...</p>

<pre><code>$user = new User();
$users = $user-&gt;getAllUsers();
$update = $user-&gt;updateUser();
$insert = $user-&gt;insertUsers();
</code></pre>

<p>It will output 3 times 'Connected' on a page, where it should do probably only once as 1 connection is enough. </p>

<p>How to fix this?</p>
