What are the advantages and disadvantages of embedding PHP within HTML code?

Embedding PHP within HTML code allows for dynamic content generation and easier integration of server-side logic with front-end design. This can streamline development and make it easier to maintain code. However, it can also lead to mixing concerns and make the code harder to read and debug.

<?php
// Example of embedding PHP within HTML code
$name = "John";
?>

<!DOCTYPE html>
<html>
<head>
    <title>Welcome</title>
</head>
<body>
    <h1>Welcome, <?php echo $name; ?>!</h1>
</body>
</html>