How can proper separation of PHP logic and HTML presentation enhance code readability and maintainability?

Proper separation of PHP logic and HTML presentation enhances code readability and maintainability by making the code easier to understand, update, and debug. By keeping the PHP logic separate from the HTML presentation, developers can focus on each aspect individually, leading to cleaner and more organized code.

<?php
// PHP logic
$userName = "John Doe";
$userAge = 30;

// HTML presentation
?>
<!DOCTYPE html>
<html>
<head>
    <title>User Profile</title>
</head>
<body>
    <h1>Welcome, <?php echo $userName; ?>!</h1>
    <p>Your age is <?php echo $userAge; ?> years old.</p>
</body>
</html>