Imported file being added to the start of the page
<p>I'm using the following function to open a file:</p>

<pre><code>    function example() {
$foo = fopen('file.txt', 'r');
while (!feof($foo)) {
    $foo2 = fgets($foo);
    echo $foo2;
}
}
</code></pre>

<p>Here's the code where it's called:</p>

<pre><code>&lt;?php

include($_SERVER['DOCUMENT_ROOT']."/class_lib.php");

$page = new Page();

    function example() {
$foo = fopen('file.txt', 'r');
while (!feof($foo)) {
    $foo2 = fgets($foo);
    echo $foo2;
}
}

$page-&gt;meta = array
(
'title' =&gt; 'snip',
'description' =&gt; 'snip'
);

$page-&gt;content = "
snipsnipsnipsnipsnipsnip
&lt;div id=\"foo\"&gt;
&lt;pre&gt;
".example()."
&lt;/pre&gt;
&lt;/div&gt;
&lt;br/&gt;snipsnip
";

$page-&gt;Display();

?&gt;
</code></pre>

<p>For some reason, even though the function is called within the pre element, it appears at the start of the page (the file is output, then the html is loaded). Same thing happens when I use include(). I must overlooking something obvious... any ideas?</p>

<p>Here's the class_lib.php if it's needed: <a href="http://pastebin.com/7euqEWNq" rel="nofollow">http://pastebin.com/7euqEWNq</a></p>
