Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

PHP - Replacing blanks with +

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

freeflow

Established Member
Impact
13
Hi everyone,

How can I replace the blanks with + in red variable?

Code:
 class RSSParser { 

   var $insideitem = false; 
   var $tag = ""; 
   var $title = ""; 
   var $description = ""; 
   var $link = ""; 

   function startElement($parser, $tagName, $attrs) { 
       if ($this->insideitem) { 
           $this->tag = $tagName; 
       } elseif ($tagName == "ITEM") { 
           $this->insideitem = true; 
       } 
   } 

   function endElement($parser, $tagName) { 
       if ($tagName == "ITEM") { 

            
           print " 
           <b>" . $this->title . "</b> 
           <div class=\"text\">" . $this->description . "<br /><a href=\"" . [COLOR="Red"]$this->title[/COLOR] . "\" target=\"_blank\"></a></div><br />";

Thanks.
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
str_replace(" ","+",$this->title)

---------- Post added at 12:52 AM ---------- Previous post was at 12:50 AM ----------

Personally, if you are trying to parse an RSS feed, I would just SimpleXML. If you need help, PM me.
 
1
Close
It worked! Thanks.
 
0
Close
I would recommend using urlencode($this->title) - it will make sure that other characters are also url friendly (other than space -> +)
 
1
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back