How can I convert a PHP variable from \"My company & My Name\" to \"my-company-my-name\"?
I need to make it all lowercase, remove all special characters and repl
Yop, and if you want to handle any special characters you'll need to declare them in the pattern, otherwise they may get flushed out. You may do it that way:
strtolower(preg_replace('/-+/', '-', preg_replace('/[^\wáéíóú]/', '-', $string)));