I know the title of the post is a bit vague, but I did not know how to best phrase this.

I want the title of a page, which is in something like "header.php" to be determined by something that comes later in the code, like something in "content.php". In particular, I am trying to make the title of a page dynamically generated, through something like:

PHP Code:
<title><?php echo $title ?></title>
But this yields an undefined variable if I assign something to title AFTER this line of code on a page. I'd appreciate any solutions or best practices to use when handling with this issue.