How does strtr() in PHP differ from str_ireplace in handling multiple strings for replacement?

When using strtr() in PHP, you can provide an array where the keys are the strings to be replaced and the values are the replacement strings. This allows for multiple replacements to be made in one function call. On the other hand, str_ireplace() only allows for one replacement string to be specified at a time, meaning you would need to call the function multiple times to replace multiple strings.

// Using strtr() to handle multiple strings for replacement
$originalString = "Hello world!";
$replacements = array("Hello" => "Hi", "world" => "universe");
$newString = strtr($originalString, $replacements);

echo $newString; // Output: "Hi universe!"