php get filename with extension from string code example Example: php get file extension from filename $ext = pathinfo($filename, PATHINFO_EXTENSION);