$filename = "test.txt"; $houzhui = substr(strrchr($filename, '.'), 1); $result = basename($filename,".".$houzhui);