How can PHP be used to customize how a website appears on Google search results?

To customize how a website appears on Google search results, you can use PHP to generate meta tags such as title, description, and keywords. By dynamically generating these meta tags based on the content of each page, you can optimize how your website appears in search engine results.

<?php
$title = "Custom Page Title";
$description = "Custom Page Description";
$keywords = "custom, keywords, for, SEO";

echo "<title>$title</title>";
echo "<meta name='description' content='$description'>";
echo "<meta name='keywords' content='$keywords'>";
?>