title: new line to <p> in php
body: <p>I currently have a lot of jokes in a database that are formated with nl2br() which produces...</p>
  
  <pre><code>This is just dummy text. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  &lt;br /&gt;&lt;br /&gt;
  Vestibulum gravida justo in arcu mattis lacinia. Mauris aliquet mi quis diam euismod blandit ultricies ac lacus.
  &lt;br /&gt;&lt;br /&gt;
  Aliquam erat volutpat. Donec sed nisi ac velit viverra hendrerit.
  &lt;br /&gt;
  Praesent molestie augue ligula, quis accumsan libero.
  </code></pre>
  
  <p>I need a php function that rather convert <code>&lt;br /&gt;&lt;br /&gt;</code> into a <code>&lt;p&gt;&lt;/p&gt;</code> and if there is only 1 <code>&lt;br /&gt;</code> then leave it alone. Also trim any whitespace</p>
  
  <p>So the end result would be...</p>
  
  <pre><code>&lt;p&gt;This is just dummy text. Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p&gt;
  &lt;p&gt;Vestibulum gravida justo in arcu mattis lacinia. Mauris aliquet mi quis diam euismod blandit ultricies ac lacus. &lt;/p&gt;
  Aliquam erat volutpat. Donec sed nisi ac velit viverra hendrerit.&lt;br /&gt;
  Praesent molestie augue ligula, quis accumsan libero.
  </code></pre>
  
  <p>can someone point me in the right direction or give me an simple function that does this? thanks</p>