Is there an inbuilt PHP function to replace multiple values inside a string with an array that dictates exactly what is replaced with what?
For example:
For what you've got there, just pass that array into str_replace as both the search and replace (using array_keys on the search parameter if you want to keep the array as-is).
str_replace
array_keys