I decided to leave str_ireplace since it's more elegant. Maybe someone will tweak this a little more in the future.