In what ways can the code snippet be refactored to adhere to PHP coding standards and improve readability for future maintenance?

The code snippet can be refactored to adhere to PHP coding standards and improve readability by using proper indentation, adding comments for clarity, and following naming conventions. Additionally, using meaningful variable names can make the code easier to understand for future maintenance.

// Refactored code snippet
$users = getUsers(); // Get users from database

foreach ($users as $user) {
    // Display user details
    echo "User ID: " . $user['id'] . "<br>";
    echo "Username: " . $user['username'] . "<br>";
    echo "Email: " . $user['email'] . "<br>";
    echo "<br>";
}

function getUsers() {
    // Database query to retrieve users
    return $users;
}