How can the PHP function "str_replace()" be utilized to replace specific characters in a string, as demonstrated in the forum thread?

To replace specific characters in a string using the PHP function "str_replace()", you can provide the function with the character or characters you want to replace, the replacement character or characters, and the original string. This function will then return a new string with the specified characters replaced.

// Original string
$string = "Hello, World!";

// Replacing the comma with a dash
$new_string = str_replace(",", "-", $string);

// Output the new string
echo $new_string;