<?php
    return array(
        'db'    => array(
            'host'  => 'localhost',
            'name'  => 'mydb',
            'user'  => 'root',
            'pass'  => 'somepass',
        )
    );
<?php
    $config = include('config.php')
    $options = [
        PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
        PDO::ATTR_EMULATE_PREPARES   => false,
    ];
    $dsn = "mysql:host=$config[db][host];dbname=$condig[db][name];charset=$config[db][charset]";
    try {
        $pdo = new PDO($dsn, $config['db']['user'], $config['db']['pass'], $options);
    } catch (\PDOException $e) {
        throw new \PDOException($e->getMessage(), (int)$e->getCode());
    }
?>
$stmt = $pdo->query('SELECT name FROM users');
while ($row = $stmt->fetch())
{
    echo $row['name'] . "\n";
}

Might as well have ripped this from https://phpdelusions.net/pdo

Jacob
Jacob

Something About Me With Multiple Lines And Markdown