title: How to insert a string of text after X paragraphs of an html fragment?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3577641/how-to-parse-and-process-html-with-php">How to parse and process HTML with PHP?</a>  </p>
  </blockquote>
  
  
  
  <pre><code>$content = "
  &lt;p&gt;This is the first paragraph&lt;/p&gt;
  &lt;p&gt;This is the second paragraph&lt;/p&gt;
  &lt;p&gt;This is the third paragraph&lt;/p&gt;";
  </code></pre>
  
  <p>Given a string of html content as above, I need to do an insert after the N'th paragraph tag.</p>
  
  <p>How can I parse the content and do an insert of a given string of text, say 'hello world' after paragraph 2?</p>