Unstoppable Domains

PHP - Replacing blanks with +

Spaceship Spaceship
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
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
•••
It worked! Thanks.
 
0
•••
I would recommend using urlencode($this->title) - it will make sure that other characters are also url friendly (other than space -> +)
 
1
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back