title: Replacing <br> with space in string using PHP
body: <p>I am trying to replace a <code>&lt;br&gt;</code> with a space within a string in PHP, however it does not seem to work. How would I go about correcting what I did to make this work?</p>
  
  <p>The line of code that I have tried is the following:</p>
  
  <pre><code>    $keyword = str_replace("&lt;br&gt;", " ", getTextBetweenTags($html, "h4", "ctlAuthor"));
  </code></pre>
  
  <p>The string that is being returned in code looks like the following:</p>
  
  <p><code>Dörte Kreher&lt;br&gt;Humboldt-Universität&lt;br&gt;Institut für Mathematik</code></p>
  
  <p>The string that is being return to the PHP page is the following:</p>
  
  <p><code>Dörte KreherHumboldt-UniversitätInstitut für Mathematik</code></p>
  
  <p>The desired string that should be returned to the PHP page:</p>
  
  <p><code>Dörte Kreher Humboldt-Universität Institut für Mathematik</code></p>
  
  <p>Here is the getTextBetweenTags() function:</p>
  
  <pre><code>function getTextBetweenTags($string, $tagname, $tagid)
  {
      $dochtml = new DOMDocument();
      $dochtml-&gt;loadHTML($string);
      $prgs = $dochtml-&gt;getElementsByTagName($tagname);
      $pcls = array();
  
      foreach($prgs as $prg)
      {
          if ($prg-&gt;getAttribute('id') == $tagid){
              $pcls[] = $prg-&gt;nodeValue;
          }
      }
      return $pcls[0];
  }
  </code></pre>