在PHP中从字符串中删除字符串的一部分

I did some work where i get a string from Google API search result snippets. In this string there contain <b> and </b> this makes problem for further work so that I need to remove <b> and </b>

The main string code:

$content_all .="#$*@#" . $json->responseData->results[$x]->content;

After I tried this code to remove <b> and </b>:

 $content_all=(string)$content_all;
str_replace("<b>", " ", $content_all);
str_replace("</b>", " ", $content_all);

but it don't remove <b> and </b>. I tried

str_replace("hello", " ", "Hello people");

It's worked. But why its not working for $content_all sting. I write the value of $content_all and it's looks like this

#$*@#These <b>sad songs</b> will definitely make you shed tears...unless you&#39;re a robot.#$*@#Check out our top 35 <b>songs</b> about heartbreak. Did we miss any? Let us know!#$*@#Feb 10, 2014 <b>...</b> &quot;Somewhere Somehow&quot; available on iTunes now! http://smarturl.it/somewhere-
somehow Music video by We The Kings performing <b>Sad Song</b> ...#$*@#Nov 12, 2015 <b>...</b> There&#39;s nothing like a <b>sad</b>, slow <b>song</b> to aid in a postbreakup cry or to be the 
soundtrack to a bad day. It&#39;s a well-known fact that music is made ...#$*@#May 12, 2015 <b>...</b> Yes, <b>sad songs</b> do say so much. And these 50 songs helped the Paste staff to 
hurt so good. I tried to keep it to one song per artist but Johnny ...#$*@#Just Cry, <b>Sad Songs</b>. Indiemono. The saddest and original playlist on Spotify, &#39;
Just Cry, <b>Sad Songs</b>&#39;, it&#39;s been active for 3 years, time of ... Song, Artist, Album ...#$*@#<b>sad songs</b>, <b>sad song</b>, saddest song in the world, world´s saddest song, battle 
song, sadsong, love song.#$*@#Last month we made a playlist of the 50 most uplifting songs ever. Now, we look 
at the opposite: 50 beautifully <b>sad songs</b>, beginning with Amy Winehouse ...#$*@#Are you looking for the best <b>sad songs</b>? Look no further, this post contains our 
favorite 20 <b>sad songs</b> of all time (as of 2015)!#$*@#8tracks radio. Online, everywhere. - stream 2500+ <b>sad songs</b> playlists including 
sad, Coldplay, and indie music from your desktop or mobile device.#$*@#Nov 6, 2015 <b>...</b> We will also be engaging in the ritual of indulging our completely unnecessary, 
sun-affected sadness by playing sad, <b>sad songs</b> on infinite ...#$*@#&quot;<b>Sad Songs</b> (Say So Much)&quot; is a song by Elton John and is the closing track on 
the 1984 album Breaking Hearts. It reached the No 5 on the U.S. chart. The lyrics
 ...#$*@#<b>Sad Songs</b> for Dirty Lovers is the second studio album by indie rock band The 
National. It was released in 2003 on Brassland Records. This is the first album on
 ...#$*@#Sep 24, 2015 <b>...</b> The popular belief that a <b>song</b> can be so <b>sad</b> that it can trigger suicide has a long 
history. Written in 1933 by Hungarian composer Seress and ...#$*@#The National - <b>Sad Songs</b> for Dirty Lovers - Amazon.com Music.#$*@#<b>Sad Songs</b> 1 Songs download Free Music Latest New Top Best Hit Play Trend 
Albums Single djjohal com 20 online dj remix.

You have to do it this way:

$content_all=str_replace("<b>", " ", $content_all);
$content_all=str_replace("</b>", " ", $content_all);

echo $content_all;

Of course, the last line is just an echo, so you can see the result.

If you want to remove html tag from a string you could go for strip_tags()

eg:

   <?php
   echo strip_tags("Hello <b>world!</b>");//Hello world
   ?>

Be careful strip_tag will remove all the tags from a string.

refer http://www.w3schools.com/php/func_string_strip_tags.asp.

one more thing if you use str_replace("<b>", " ", $content_all); then it will give unwanted space

ie:str_replace("<b>", " ", "hi <br><br> vig");
result: hi      vig