title: How to use preg_replace_callback?
body: <p>I have the following HTML statement</p>
  
  <pre><code>[otsection]Wallpapers[/otsection]
  WALLPAPERS GO HERE
  
  [otsection]Videos[/otsection]
  VIDEOS GO HERE
  </code></pre>
  
  <p>What I am trying to do is replace the [otsection] tags with an html div.  The catch is I want to increment the id of the div from 1->2->3, etc..</p>
  
  <p>So for example, the above statement should be translated to</p>
  
  <pre><code>&lt;div class="otsection" id="1"&gt;Wallpapers&lt;/div&gt;
  WALLPAPERS GO HERE
  
  &lt;div class="otsection" id="2"&gt;Videos&lt;/div&gt;
  VIDEOS GO HERE
  </code></pre>
  
  <p>As far as I can research, the best way to do this is via a preg_replace_callback to increment the id variable between each replacement.  But after 1 hour of working on this, I just cant get it working.  </p>
  
  <p>Any assistance with this would be much appreciated!</p>