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

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

<?php

// Retrieve user input from form
$username = $_POST['username'];
$password = $_POST['password'];

// Validate user input
if (empty($username) || empty($password)) {
    echo "Username and password are required.";
} else {
    // Process login logic
    if ($username === 'admin' && $password === 'password') {
        echo "Login successful!";
    } else {
        echo "Invalid username or password.";
    }
}

?>