Search code examples
phptwitter

How to replace &apos ($song[1]) with a single quote


$twitterObj->post('/statuses/update.json', 
    array('status' => '#NowPlaying ' . $song[1] . 
        ':: Metal Rock 1970 - 2000 - http://metalrockpopradio.caramania.com'));
?> 

Solution

  • In case you want that string gone:

    $song[1] = str_replace('&apos','', $song[1]);
    

    To replace with a quote

    $song[1] = str_replace('&apos',"'", $song[1]);
    

    If ' had a semicolon at the end you could do:

    $song[1] = html_entity_decode($song[1], ENT_QUOTES | ENT_HTML5);
    

    Place this line above the $twitterObj->post

    Also isn't that &apos missing a ; at the end?