In the provided PHP code, what improvements can be made to enhance readability and maintainability?

The provided PHP code lacks proper indentation and comments, making it harder to read and maintain. To enhance readability and maintainability, we can add comments to explain the purpose of each section of code and properly indent the code for better structure.

<?php

// Define constants for database connection
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', 'password');
define('DB_NAME', 'my_database');

// Establish a database connection
$connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

// Check for connection errors
if ($connection->connect_error) {
    die("Connection failed: " . $connection->connect_error);
}

// Perform database operations here

// Close the database connection
$connection->close();

?>