Unwanted repeating html result from PHP
<p>I don't know what is wrong with this code, it is a bug or I made a mistake somewhere; xDebug show nothing.</p>

<h3>Class script</h3>

<pre><code>class theme {
    function theme() {
        //show header (meta, style, htmldoctype, script, and title) 
        $this-&gt;htmlheader();

        //show main content
        //show footer
    }


    function htmlheader() {
        require "localsettings.php";
        echo "&lt;!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"&gt;\n&lt;html&gt;\n&lt;head&gt;\n";
        echo "&lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"&gt;\n";

        echo "&lt;title&gt;$site_name - $page_title&lt;/title&gt;\n";
        echo "&lt;/head&gt;\n";
    }
}
</code></pre>

<h3>index.php</h3>

<pre><code>require "theme.class.php";
$html = new theme();
//display result
$html-&gt;theme();
</code></pre>

<h3>Output (incorrectly repeated)</h3>

<pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
&lt;title&gt;site title - &lt;/title&gt;
&lt;/head&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
&lt;title&gt;site title - &lt;/title&gt;
&lt;/head&gt;
</code></pre>
