How can include and require statements be utilized effectively in PHP scripts to ensure proper variable declaration and usage?

To ensure proper variable declaration and usage in PHP scripts, include and require statements can be used effectively to bring in external files that contain necessary functions or variable definitions. By including or requiring these files at the beginning of your script, you can ensure that all variables are properly declared before they are used, preventing errors due to undefined variables.

<?php
// Include the file containing variable definitions
require_once 'variables.php';

// Use the variables in your script
echo "My name is " . $name . " and I am " . $age . " years old.";
?>