Sorry, typos in my code. There was a missing closing ā)ā in the if statement (a bad habit of mine when Iām in a hurry). There was also an error in my snippet tag (forgot the "?"). My apologies. In my defense, I had just driven an RV towing a car 230 miles that included two major mountain passes.
(fixed in the earlier code).
Your code is fine, but would be better if you put $output back in and returned it.