What PHP function can be used to remove specific characters from a string?

To remove specific characters from a string in PHP, you can use the `str_replace()` function. This function replaces all occurrences of a specified character or characters in a string with another character or characters. You can pass the characters you want to remove as the second argument and an empty string as the third argument to effectively remove them from the string.

// Input string
$inputString = "Hello, World!";

// Characters to remove
$charactersToRemove = array(",", "!");

// Remove specified characters
$outputString = str_replace($charactersToRemove, "", $inputString);

// Output the modified string
echo $outputString; // Output: Hello World