What PHP functions can be used to convert uppercase letters to lowercase and replace spaces with underscores?

To convert uppercase letters to lowercase and replace spaces with underscores in PHP, you can use the strtolower() function to convert uppercase letters to lowercase and str_replace() function to replace spaces with underscores.

$string = "Convert UPPERCASE Letters and Replace Spaces";
$string = strtolower($string);
$string = str_replace(' ', '_', $string);
echo $string;