How to insert new element after specific element in html using php?
<p>I'm really struggling to get my head around <code>DOMDocument</code> parsing.
I'm trying to solve the following problem.
Given the following HTML</p>

<pre><code>&lt;h1&gt;Title&lt;/h1&gt;
&lt;p&gt;Some Content&lt;/p&gt;
&lt;p&gt;Some More Content&lt;/p&gt;
&lt;p&gt;Other Content&lt;/p&gt;
&lt;p&gt;Last Bit of Content&lt;/p&gt;
</code></pre>

<p>I want to add in a div with something else after the second paragraph tag. 
Essentially the outcome needs to be something like the following</p>

<pre><code>&lt;h1&gt;Title&lt;/h1&gt;
&lt;p&gt;Some Content&lt;/p&gt;
&lt;p&gt;Some More Content&lt;/p&gt;
&lt;div&gt;Something different&lt;/div&gt; &lt;!-- new tag --&gt;
&lt;p&gt;Other Content&lt;/p&gt;
&lt;p&gt;Last Bit of Content&lt;/p&gt;
</code></pre>

<p>Having looked at a few post on here I'm now getting bored of scratching my head now.</p>