$ext = pathinfo($filename, PATHINFO_EXTENSION); //Remember that if you want to be able to deal with non ASCII characters, you need to set the locale first. E.G: setlocale(LC_ALL,'en_US.UTF-8');