What are the limitations of embedding JavaScript in PHP scripts?

Embedding JavaScript in PHP scripts can lead to messy and hard-to-maintain code. It can also make it difficult to separate the client-side and server-side logic, which can result in issues with debugging and performance. To solve this, it is recommended to keep JavaScript separate from PHP scripts by using external JavaScript files and properly structuring your code.

<!DOCTYPE html>
<html>
<head>
    <title>Embedding JavaScript in PHP</title>
    <script src="script.js"></script>
</head>
<body>
    <?php
    // PHP code here
    ?>
</body>
</html>