I have read through all the questions regarding this, and would like to know if $str = preg_replace('/[^\00-\255]+/u', '', $str);
is sufficient for my scenario.
My Scenario
When a user creates an account on my site, he enters his company's name. This can be anything including text with '
or "
or even some other strange characters. When he creates an account, I need to create a folder on my server for him to access his account easier without using uniqids
etc.
So for example you create an account for "Peter's Pet Shop & Washing" - I would need to remove all spaces and characters that would not be allowed as a url-address. So at the end I need to have "peterspetshopwashing"
This is so that you can access your account at "www.mydomain.com/peterspetshopwashing"
I currently use this function I'm happy with
it replaces spaces and other odd characters with
-
so result will bepeter-s-pet-shop-washing