Sorry, this is what it should be:
–
Just to let those who are interested know that the function works perfectly just the the value for the str_replace was wrong. The dash is produced using an Unicode character so when I change ‘-‘ to ‘–’ it worked.