too long

How can i delete a html-special char \ from a string.

$string = 'This is \ a string with \ special characters \';
str_replace("char_to_rep","",$string); // replacing with nothing means deleting 


also ref. how-to-remove-html-special-chars

use str_replace and replace special char with an empty character

str_replace("#"," ",$string)

try this code for all special char

thanks a lot for help, but is there a better way tho do this below?

    $post = '(&repl^eac&e_+';

    function repleace($post) {
        $array = array('.html', '.php', '±', '§', '!', '@', '€', '`', '#', '$', '%', '^', '&', '*', '(', ')', '+', '=', '<', '>', '?', '/', '|', '[', ']', ':', ';', ',', '~', '.');
        $post = str_replace($array, '', $post);
        $post = str_replace(' ', '_', $post);
        $post = str_replace('-', '_', $post);
        return strtolower('/'.$post.'/');
    }
function($input) {
   $input = preg_replace("/&#?[a-z0-9]{2,8};/i","",$input);
   $input = ucfirst($input);
   return $input;
}

The php pre_repleace function within the /&#?[a-z0-9]{2,8};/i characters works fine.