title: How to run a php script after the HTML has been fully rendered
body: <p>I have a beginner php question:</p>
  
  <p>Suppose I have a simple php file on my server creating some HTML, for example <a href="http://www.codecademy.com/courses/web-beginner-en-StaFQ/0/1?curriculum_id=5124ef4c78d510dd89003eb8" rel="nofollow">this</a>. How can I run a php script that runs over the fully generated HTML code, after all other php scripts have finished, and modifies it? Lets say for example I want to turn all the <code>&lt;li&gt;</code> tags into <code>&lt;p&gt;</code> tags.</p>
  
  <p>Should this be referenced in the php file itself, or is it better to implement it as an output filter? What is the standard way to call a script after the HTML is ready?</p>
  
  <p>Thanks</p>
  
  <p>--EDIT--</p>
  
  <p>To clarify - I want the script to receive the final value of the HTML the server sends to the client - after all server side script have finished running (other PHP), but before any HTML/Javascript is executed on the server side, and output a modified version of it.</p>