What is the easiest way to remove all non-word characters of a filename?
The dot at the end before the extension is obviously needed, so all symbols like "-
" or "*
" or "?
" should be removed except ".
"
Something like this:
$filename = preg_replace("/[^\.]\W/", "", $filename);