how to remove %20 in the url in php



PHP Snippet 1:

echo urldecode('newsdetail.php?id=In%20front%20%20of%20the%20houses');

PHP Snippet 2:

newsdetail.php?id=In front of the houses

PHP Snippet 3:

function cleanURL($textURL) {
  $URL = strtolower(preg_replace( array('/[^a-z0-9\- ]/i', '/[ \-]+/'), array('', '-'), $textURL));
            return $URL;
     }



while($row1=mysql_fetch_array($qry)) {
        <p class='news_title'><a href='newsdetail.php?id=".cleanURL($row1['news_heading'])."'>{$row1['news_heading']}</a></p>
    }

PHP Snippet 4:

$url = str_replace(' ', '-', strtolower($news_heading));