<?php
declare(strict_types=1);

function db(): PDO {
  static $pdo = null;
  if ($pdo instanceof PDO) return $pdo;

 $host = "localhost";
$dbname = "hamdanle_hleg607";
$user = "hamdanle_hleg607";
$pass = "@Saif1979s";

  $charset = 'utf8mb4';

  $dsn = "mysql:host={$host};dbname={$dbname};charset={$charset}";
  $pdo = new PDO($dsn, $user, $pass, [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES => false,
  ]);

  return $pdo;
}