What is the best practice for implementing different meta tags on subpages in PHP?

When implementing different meta tags on subpages in PHP, the best practice is to dynamically generate the meta tags based on the specific content of each subpage. This can be achieved by passing meta tag information as variables or using a database to store and retrieve meta tag data for each subpage.

<?php
// Assuming $pageTitle, $pageDescription, and $pageKeywords are set based on the specific content of each subpage
echo "<title>$pageTitle</title>";
echo "<meta name='description' content='$pageDescription'>";
echo "<meta name='keywords' content='$pageKeywords'>";
?>