How can PHP beginners effectively integrate PHP scripts with HTML templates?

PHP beginners can effectively integrate PHP scripts with HTML templates by using PHP's `include` function to include PHP scripts within HTML files. This allows for the separation of logic and presentation, making the code more organized and maintainable. By creating separate PHP files for logic and HTML templates, beginners can easily update the design without affecting the underlying functionality.

<?php
// logic.php
$variable = "Hello, World!";
?>

<!DOCTYPE html>
<html>
<head>
    <title>PHP Integration</title>
</head>
<body>
    <h1><?php include 'logic.php'; echo $variable; ?></h1>
</body>
</html>