PHP function to replace file extension.