Hello everybody, I'm new here but I'm a novice with PHP. I've been racking my brain for the past couple of hours with this problem, so I hope you can help me out. So I've got two PHP files, one file (test1.php) [i]includes[/i] the parsed contents of the other (test2.php) using the output buffer functions (ob_start, ob_get_contents, ob_end_clean). The special condition is that test2.php uses a global variable in its code. It seems to work, except when I refactor the code in test1.php into a function, it stops working. Here's a test case: [url=http://brianpeiris.com/test/test1.php?work=1]http://brianpeiris.com/test/test1.php?work=1[/url] - This link shows the output of the working code. [url=http://brianpeiris.com/test/test1.php?work=0]http://brianpeiris.com/test/test1.php?work=0[/url] - This link shows the output of the broken code. Here are the source files: [url=http://brianpeiris.com/test/test1.php.txt]http://brianpeiris.com/test/test1.php.txt[/url] [url=http://brianpeiris.com/test/test2.php.txt]http://brianpeiris.com/test/test2.php.txt[/url] The problem occurs on both PHP4 and PHP5. TIA, Brian.