title: Removing empty spaces and BR from string in echo
body: <p>I got the below code but at the moment it generates a string of results but with about 40+ empty spaces.</p>
  
  <pre><code>$user_  = JFactory::getUser();
  $db     = JFactory::getDBO();
  $levels = JAccess::getAuthorisedViewLevels($user-&gt;id);
  foreach($levels as $key =&gt; $level)
  {
    $query  = 'SELECT title FROM #__pf_projects';
    $query .= ' WHERE access = ' . $level . " AND TRIM(title) != ''";
    $db-&gt;setQuery($query);
    $projectlist = $db-&gt;loadResult($query).'&lt;br&gt;';
    echo $projectlist;
  }
  </code></pre>
  
  <p>At first I thought that <code>array_filter()</code> would be good here but as PatrickQ points out it is a string so the array filter won't work. 
  Then I adapted the code according to the answer from Don't Panic. This adapted code is what you can see above.</p>
  
  <p>It returns now a list like this.</p>
  
  <pre><code>&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  http://www.domain1.com
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  http://www.domain5.com
  http://www.domain23.com
  http://www.domain65.com
  http://www.domain213.com
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  </code></pre>
  
  <p>So how to adapt the code to just get a list like this:</p>
  
  <pre><code>http://www.domain1.com
  http://www.domain5.com
  http://www.domain23.com
  http://www.domain65.com
  http://www.domain213.com
  </code></pre>
  
  <p>When you change the <code>&lt;br&gt;</code> into a <code>,</code> then the list becomes <code>,,,,,,,,,,,http,,,,,,httphttphttphttp,,,,,,,</code> &lt;= I wrote it down a bit shorter.</p>