What are the differences between str_replace, ereg_replace, and preg_replace functions in PHP when it comes to removing slashes?

When removing slashes in PHP, it's important to use the correct function depending on the PHP version you are using. The `str_replace` function is simple and effective for basic string replacement, but it may not handle all cases of removing slashes. `ereg_replace` is deprecated as of PHP 5.3.0 and should not be used. `preg_replace` is the recommended function for more complex string manipulation, including removing slashes.

// Using preg_replace to remove slashes
$string = "This is a string with slashes: \\/";
$cleaned_string = preg_replace('/\\\\/', '', $string);
echo $cleaned_string;