title: On the fly XHTML validation (PHP output)
body: <p>Given I have a php script of arbitrary complexity, running on an apache2 webserver, and I want to check that this script outputs only valid xhtml.</p>
  
  <p>One way to achieve this that occurred to me was validating the output of this php script IN the script every time it is run, and storing generated errors and warnings in a mysql database.</p>
  
  <p>Is this possible?</p>
  
  <p>Thanks!</p>
  
  <p><strong>EDIT:</strong> I guess the main problem here is getting the output of the current script without rewriting every <code>echo</code> call.</p>
  
  <p><strong>EDIT2:</strong> I'd prefer the w3c sgml validation over html tidy.</p>