title: php string manipulation - replacing and removing characters
body: <p>Trying to figure out a way to perform string manipulation in php.  In the example below I need to recognize all instances of [backspace] and remove them from the string, BUT I also need to remove the character immediately before it as well.</p>
  
  <pre><code>$string = "this is a sentence with dog[backspace][backspace][backspace]cat in it";
  </code></pre>
  
  <p>would become "this is a sentence with cat in it".</p>
  
  <p>My initial thought was turning the string into an array and performing the operation that way somehow as I don't believe there is any way I could do this with str_replace.</p>
  
  <pre><code>$array = str_split($string);
  
  foreach($array as $key)
  {
     .. lost here
  }
  </code></pre>