File Format List For HTML Drop Down, JavaScript, PHP


This page provides a detailed list of file types, sorted into groups like Documents, Spreadsheets, and Images. It includes data in three different formats: HTML drop down, JavaScript arrays, and PHP arrays. This variety of formats makes it easy to use in different web development situations.

Great for developers working on file upload systems, format checkers, or dropdown menus, these lists provide a neat way to manage common file extensions. Just copy and paste the snippet in your project to easily add many file format choices.

Create Custom File Formats for Your Needs

Customize your preferred file format names by selecting from the options provided in the table. You can then include these selected file format names in the dropdown menu or JavaScript array and PHP array. The selected file format codes will be displayed below

×
# Extension Full Name Select
1pdfPDF (Portable Document Format)
2docDOC (Microsoft Word Document)
3docxDOCX (Microsoft Word Open XML Document)
4txtTXT (Plain Text)
5rtfRTF (Rich Text Format)
6odtODT (OpenDocument Text)
7odfODF (Open Document Format)
8psPS (PostScript)
9xpsXPS (XML Paper Specification)
10xlsXLS (Microsoft Excel Spreadsheet)

HTML Drop Down

This is the part of the HTML code for choosing a file format drop-down.

HTML
<select id="file-format" name="file-format" aria-label="Select a file format">
    <option value="">Select a file format</option>
    <optgroup label="Documents">
        <option value="pdf">PDF (Portable Document Format)</option>
        <option value="doc">DOC (Microsoft Word Document)</option>
        <option value="docx">DOCX (Microsoft Word Open XML Document)</option>
        <option value="txt">TXT (Plain Text)</option>
        <option value="rtf">RTF (Rich Text Format)</option>
        <option value="odt">ODT (OpenDocument Text)</option>
        <option value="odf">ODF (Open Document Format)</option>
        <option value="ps">PS (PostScript)</option>
        <option value="xps">XPS (XML Paper Specification)</option>
    </optgroup>

    <optgroup label="Spreadsheets">
        <option value="xls">XLS (Microsoft Excel Spreadsheet)</option>
        <option value="xlsx">XLSX (Microsoft Excel Open XML Spreadsheet)</option>
        <option value="csv">CSV (Comma-Separated Values)</option>
        <option value="ods">ODS (OpenDocument Spreadsheet)</option>
        <option value="xlsm">XLSM (Excel Macro-Enabled Spreadsheet)</option>
        <option value="numbers">NUMBERS (Apple Numbers Spreadsheet)</option>
    </optgroup>

    <optgroup label="Presentations">
        <option value="ppt">PPT (Microsoft PowerPoint Presentation)</option>
        <option value="pptx">PPTX (Microsoft PowerPoint Open XML Presentation)</option>
        <option value="odp">ODP (OpenDocument Presentation)</option>
        <option value="pps">PPS (PowerPoint Slide Show)</option>
        <option value="ppsx">PPSX (PowerPoint Open XML Slide Show)</option>
        <option value="pez">PEZ (Prezi Presentation)</option>
    </optgroup>

    <optgroup label="Images">
        <option value="jpg">JPG (Joint Photographic Experts Group)</option>
        <option value="jpeg">JPEG (Joint Photographic Experts Group)</option>
        <option value="png">PNG (Portable Network Graphics)</option>
        <option value="gif">GIF (Graphics Interchange Format)</option>
        <option value="svg">SVG (Scalable Vector Graphics)</option>
        <option value="webp">WebP (Web Picture Format)</option>
        <option value="tiff">TIFF (Tagged Image File Format)</option>
        <option value="psd">PSD (Photoshop Document)</option>
        <option value="ai">AI (Adobe Illustrator)</option>
        <option value="eps">EPS (Encapsulated PostScript)</option>
        <option value="ico">ICO (Icon File)</option>
    </optgroup>

    <optgroup label="Data">
        <option value="yaml">YAML (YAML Ain't Markup Language)</option>
        <option value="tsv">TSV (Tab-Separated Values)</option>
        <option value="psv">PSV (Pipe-Separated Values)</option>
        <option value="hdf5">HDF5 (Hierarchical Data Format version 5)</option>
    </optgroup>

    <optgroup label="Archives">
        <option value="zip">ZIP (Compressed File Archive)</option>
        <option value="rar">RAR (Roshal Archive)</option>
        <option value="7z">7Z (7-Zip Compressed File)</option>
        <option value="tar">TAR (Tape Archive)</option>
        <option value="gz">GZ (Gzip Compressed File)</option>
        <option value="iso">ISO (Disc Image File)</option>
        <option value="dmg">DMG (Apple Disk Image)</option>
        <option value="lzh">LZH (Lempel-Ziv-Huffman Compressed File)</option>
        <option value="cab">CAB (Windows Cabinet File)</option>
    </optgroup>

    <optgroup label="Audio">
        <option value="mp3">MP3 (MPEG Audio Layer III)</option>
        <option value="wav">WAV (Waveform Audio File Format)</option>
        <option value="ogg">OGG (Ogg Vorbis Audio)</option>
        <option value="flac">FLAC (Free Lossless Audio Codec)</option>
        <option value="wma">WMA (Windows Media Audio)</option>
        <option value="aiff">AIFF (Audio Interchange File Format)</option>
        <option value="alac">ALAC (Apple Lossless Audio Codec)</option>
        <option value="dsd">DSD (Direct Stream Digital)</option>
    </optgroup>

    <optgroup label="Video">
        <option value="mp4">MP4 (MPEG-4 Part 14)</option>
        <option value="avi">AVI (Audio Video Interleave)</option>
        <option value="mov">MOV (QuickTime Movie)</option>
        <option value="mkv">MKV (Matroska Video)</option>
        <option value="wmv">WMV (Windows Media Video)</option>
        <option value="mpeg">MPEG (Moving Picture Experts Group)</option>
        <option value="m4v">M4V (MPEG-4 Video File)</option>
        <option value="3gp">3GP (3rd Generation Partnership Project)</option>
        <option value="swf">SWF (Shockwave Flash)</option>
    </optgroup>

    <optgroup label="CAD Files">
        <option value="dwg">DWG (AutoCAD Drawing)</option>
        <option value="dxf">DXF (Drawing Exchange Format)</option>
    </optgroup>

    <optgroup label="Font Files">
        <option value="ttf">TTF (TrueType Font)</option>
        <option value="otf">OTF (OpenType Font)</option>
    </optgroup>

    <optgroup label="Ebooks">
        <option value="epub">EPUB (Electronic Publication)</option>
        <option value="fb2">FB2 (FictionBook 2.0)</option>
        <option value="lit">LIT (Microsoft Reader eBook)</option>
        <option value="lrf">LRF (Sony Portable Reader File)</option>
    </optgroup>

    <optgroup label="Web">
        <option value="json">JSON (JavaScript Object Notation)</option>
        <option value="html">HTML (Hypertext Markup Language)</option>
        <option value="css">CSS (Cascading Style Sheets)</option>
        <option value="js">JS (JavaScript)</option>
        <option value="xml">XML (Extensible Markup Language)</option>
        <option value="xhtml">XHTML (Extensible Hypertext Markup Language)</option>
    </optgroup>

    <optgroup label="Programming">
        <option value="py">PY (Python Source Code)</option>
        <option value="java">JAVA (Java Source Code)</option>
        <option value="cpp">CPP (C++ Source Code)</option>
        <option value="go">GO (Go Source Code)</option>
        <option value="kt">KT (Kotlin Source Code)</option>
        <option value="r">R (R Script)</option>
        <option value="swift">SWIFT (Swift Source Code)</option>
        <option value="scala">SCALA (Scala Source Code)</option>
        <option value="jsx">JSX (JavaScript XML)</option>
        <option value="php">PHP (PHP: Hypertext Preprocessor)</option>
    </optgroup>
</select>

JavaScript Array

JavaScript Array of file format list

JavaScript
const fileFormats = [
  {
    category: "Documents",
    formats: [
      { extension: "pdf", fullName: "PDF (Portable Document Format)" },
      { extension: "doc", fullName: "DOC (Microsoft Word Document)" },
      { extension: "docx", fullName: "DOCX (Microsoft Word Open XML Document)" },
      { extension: "txt", fullName: "TXT (Plain Text)" },
      { extension: "rtf", fullName: "RTF (Rich Text Format)" },
      { extension: "odt", fullName: "ODT (OpenDocument Text)" },
      { extension: "odf", fullName: "ODF (Open Document Format)" },
      { extension: "ps", fullName: "PS (PostScript)" },
      { extension: "xps", fullName: "XPS (XML Paper Specification)" }
    ]
  },
  {
    category: "Spreadsheets",
    formats: [
      { extension: "xls", fullName: "XLS (Microsoft Excel Spreadsheet)" },
      { extension: "xlsx", fullName: "XLSX (Microsoft Excel Open XML Spreadsheet)" },
      { extension: "csv", fullName: "CSV (Comma-Separated Values)" },
      { extension: "ods", fullName: "ODS (OpenDocument Spreadsheet)" },
      { extension: "xlsm", fullName: "XLSM (Excel Macro-Enabled Spreadsheet)" },
      { extension: "numbers", fullName: "NUMBERS (Apple Numbers Spreadsheet)" }
    ]
  },
  {
    category: "Presentations",
    formats: [
      { extension: "ppt", fullName: "PPT (Microsoft PowerPoint Presentation)" },
      { extension: "pptx", fullName: "PPTX (Microsoft PowerPoint Open XML Presentation)" },
      { extension: "odp", fullName: "ODP (OpenDocument Presentation)" },
      { extension: "pps", fullName: "PPS (PowerPoint Slide Show)" },
      { extension: "ppsx", fullName: "PPSX (PowerPoint Open XML Slide Show)" },
      { extension: "pez", fullName: "PEZ (Prezi Presentation)" }
    ]
  },
  {
    category: "Images",
    formats: [
      { extension: "jpg", fullName: "JPG (Joint Photographic Experts Group)" },
      { extension: "jpeg", fullName: "JPEG (Joint Photographic Experts Group)" },
      { extension: "png", fullName: "PNG (Portable Network Graphics)" },
      { extension: "gif", fullName: "GIF (Graphics Interchange Format)" },
      { extension: "svg", fullName: "SVG (Scalable Vector Graphics)" },
      { extension: "webp", fullName: "WebP (Web Picture Format)" },
      { extension: "tiff", fullName: "TIFF (Tagged Image File Format)" },
      { extension: "psd", fullName: "PSD (Photoshop Document)" },
      { extension: "ai", fullName: "AI (Adobe Illustrator)" },
      { extension: "eps", fullName: "EPS (Encapsulated PostScript)" },
      { extension: "ico", fullName: "ICO (Icon File)" }
    ]
  },
  {
    category: "Data",
    formats: [
      { extension: "yaml", fullName: "YAML (YAML Ain't Markup Language)" },
      { extension: "tsv", fullName: "TSV (Tab-Separated Values)" },
      { extension: "psv", fullName: "PSV (Pipe-Separated Values)" },
      { extension: "hdf5", fullName: "HDF5 (Hierarchical Data Format version 5)" }
    ]
  },
  {
    category: "Archives",
    formats: [
      { extension: "zip", fullName: "ZIP (Compressed File Archive)" },
      { extension: "rar", fullName: "RAR (Roshal Archive)" },
      { extension: "7z", fullName: "7Z (7-Zip Compressed File)" },
      { extension: "tar", fullName: "TAR (Tape Archive)" },
      { extension: "gz", fullName: "GZ (Gzip Compressed File)" },
      { extension: "iso", fullName: "ISO (Disc Image File)" },
      { extension: "dmg", fullName: "DMG (Apple Disk Image)" },
      { extension: "lzh", fullName: "LZH (Lempel-Ziv-Huffman Compressed File)" },
      { extension: "cab", fullName: "CAB (Windows Cabinet File)" }
    ]
  },
  {
    category: "Audio",
    formats: [
      { extension: "mp3", fullName: "MP3 (MPEG Audio Layer III)" },
      { extension: "wav", fullName: "WAV (Waveform Audio File Format)" },
      { extension: "ogg", fullName: "OGG (Ogg Vorbis Audio)" },
      { extension: "flac", fullName: "FLAC (Free Lossless Audio Codec)" },
      { extension: "wma", fullName: "WMA (Windows Media Audio)" },
      { extension: "aiff", fullName: "AIFF (Audio Interchange File Format)" },
      { extension: "alac", fullName: "ALAC (Apple Lossless Audio Codec)" },
      { extension: "dsd", fullName: "DSD (Direct Stream Digital)" }
    ]
  },
  {
    category: "Video",
    formats: [
      { extension: "mp4", fullName: "MP4 (MPEG-4 Part 14)" },
      { extension: "avi", fullName: "AVI (Audio Video Interleave)" },
      { extension: "mov", fullName: "MOV (QuickTime Movie)" },
      { extension: "mkv", fullName: "MKV (Matroska Video)" },
      { extension: "wmv", fullName: "WMV (Windows Media Video)" },
      { extension: "mpeg", fullName: "MPEG (Moving Picture Experts Group)" },
      { extension: "m4v", fullName: "M4V (MPEG-4 Video File)" },
      { extension: "3gp", fullName: "3GP (3rd Generation Partnership Project)" },
      { extension: "swf", fullName: "SWF (Shockwave Flash)" }
    ]
  },
  {
    category: "CAD Files",
    formats: [
      { extension: "dwg", fullName: "DWG (AutoCAD Drawing)" },
      { extension: "dxf", fullName: "DXF (Drawing Exchange Format)" }
    ]
  },
  {
    category: "Font Files",
    formats: [
      { extension: "ttf", fullName: "TTF (TrueType Font)" },
      { extension: "otf", fullName: "OTF (OpenType Font)" }
    ]
  },
  {
    category: "Ebooks",
    formats: [
      { extension: "epub", fullName: "EPUB (Electronic Publication)" },
      { extension: "fb2", fullName: "FB2 (FictionBook 2.0)" },
      { extension: "lit", fullName: "LIT (Microsoft Reader eBook)" },
      { extension: "lrf", fullName: "LRF (Sony Portable Reader File)" }
    ]
  },
  {
    category: "Web",
    formats: [
      { extension: "html", fullName: "HTML (Hypertext Markup Language)" },
      { extension: "css", fullName: "CSS (Cascading Style Sheets)" },
      { extension: "js", fullName: "JS (JavaScript)" },
      { extension: "xml", fullName: "XML (Extensible Markup Language)" },
      { extension: "json", fullName: "JSON (JavaScript Object Notation)" },
      { extension: "xhtml", fullName: "XHTML (Extensible Hypertext Markup Language)" }
    ]
  },
  {
    category: "Programming",
    formats: [
      { extension: "py", fullName: "PY (Python Source Code)" },
      { extension: "java", fullName: "JAVA (Java Source Code)" },
      { extension: "cpp", fullName: "CPP (C++ Source Code)" },
      { extension: "go", fullName: "GO (Go Source Code)" },
      { extension: "kt", fullName: "KT (Kotlin Source Code)" },
      { extension: "r", fullName: "R (R Script)" },
      { extension: "swift", fullName: "SWIFT (Swift Source Code)" },
      { extension: "scala", fullName: "SCALA (Scala Source Code)" },
      { extension: "jsx", fullName: "JSX (JavaScript XML)" },
      { extension: "php", fullName: "PHP (PHP: Hypertext Preprocessor)" },
    ]
  }
];

Usage Example

Use this array to create a dropdown menu

HTML
<select id="file-format"></select>
javaScripr
const fileFormatSelect = document.getElementById("file-format");

fileFormats.forEach(group => {
    const optgroup = document.createElement("optgroup");
    optgroup.label = group.category;

    group.formats.forEach(option => {
        const optionElement = document.createElement("option");
        optionElement.value = option.extension;
        optionElement.textContent = option.fullName;
        optgroup.appendChild(optionElement);
    });

    fileFormatSelect.appendChild(optgroup);
});

Try it your self Real Time Preview

PHP Array

Array of news categories

PHP
<?php

$fileFormats = [
    [
        'category' => 'Documents',
        'formats' => [
            ['extension' => 'pdf', 'fullName' => 'PDF (Portable Document Format)'],
            ['extension' => 'doc', 'fullName' => 'DOC (Microsoft Word Document)'],
            ['extension' => 'docx', 'fullName' => 'DOCX (Microsoft Word Open XML Document)'],
            ['extension' => 'txt', 'fullName' => 'TXT (Plain Text)'],
            ['extension' => 'rtf', 'fullName' => 'RTF (Rich Text Format)'],
            ['extension' => 'odt', 'fullName' => 'ODT (OpenDocument Text)'],
            ['extension' => 'odf', 'fullName' => 'ODF (Open Document Format)'],
            ['extension' => 'ps', 'fullName' => 'PS (PostScript)'],
            ['extension' => 'xps', 'fullName' => 'XPS (XML Paper Specification)'],
        ],
    ],
    [
        'category' => 'Spreadsheets',
        'formats' => [
            ['extension' => 'xls', 'fullName' => 'XLS (Microsoft Excel Spreadsheet)'],
            ['extension' => 'xlsx', 'fullName' => 'XLSX (Microsoft Excel Open XML Spreadsheet)'],
            ['extension' => 'csv', 'fullName' => 'CSV (Comma-Separated Values)'],
            ['extension' => 'ods', 'fullName' => 'ODS (OpenDocument Spreadsheet)'],
            ['extension' => 'xlsm', 'fullName' => 'XLSM (Excel Macro-Enabled Spreadsheet)'],
            ['extension' => 'numbers', 'fullName' => 'NUMBERS (Apple Numbers Spreadsheet)'],
        ],
    ],
    [
        'category' => 'Presentations',
        'formats' => [
            ['extension' => 'ppt', 'fullName' => 'PPT (Microsoft PowerPoint Presentation)'],
            ['extension' => 'pptx', 'fullName' => 'PPTX (Microsoft PowerPoint Open XML Presentation)'],
            ['extension' => 'odp', 'fullName' => 'ODP (OpenDocument Presentation)'],
            ['extension' => 'pps', 'fullName' => 'PPS (PowerPoint Slide Show)'],
            ['extension' => 'ppsx', 'fullName' => 'PPSX (PowerPoint Open XML Slide Show)'],
            ['extension' => 'pez', 'fullName' => 'PEZ (Prezi Presentation)'],
        ],
    ],
    [
        'category' => 'Images',
        'formats' => [
            ['extension' => 'jpg', 'fullName' => 'JPG (Joint Photographic Experts Group)'],
            ['extension' => 'jpeg', 'fullName' => 'JPEG (Joint Photographic Experts Group)'],
            ['extension' => 'png', 'fullName' => 'PNG (Portable Network Graphics)'],
            ['extension' => 'gif', 'fullName' => 'GIF (Graphics Interchange Format)'],
            ['extension' => 'svg', 'fullName' => 'SVG (Scalable Vector Graphics)'],
            ['extension' => 'webp', 'fullName' => 'WebP (Web Picture Format)'],
            ['extension' => 'tiff', 'fullName' => 'TIFF (Tagged Image File Format)'],
            ['extension' => 'psd', 'fullName' => 'PSD (Photoshop Document)'],
            ['extension' => 'ai', 'fullName' => 'AI (Adobe Illustrator)'],
            ['extension' => 'eps', 'fullName' => 'EPS (Encapsulated PostScript)'],
            ['extension' => 'ico', 'fullName' => 'ICO (Icon File)'],
        ],
    ],
    [
        'category' => 'Data',
        'formats' => [
            ['extension' => 'yaml', 'fullName' => 'YAML (YAML Ain\'t Markup Language)'],
            ['extension' => 'tsv', 'fullName' => 'TSV (Tab-Separated Values)'],
            ['extension' => 'psv', 'fullName' => 'PSV (Pipe-Separated Values)'],
            ['extension' => 'hdf5', 'fullName' => 'HDF5 (Hierarchical Data Format version 5)'],
        ],
    ],
    [
        'category' => 'Archives',
        'formats' => [
            ['extension' => 'zip', 'fullName' => 'ZIP (Compressed File Archive)'],
            ['extension' => 'rar', 'fullName' => 'RAR (Roshal Archive)'],
            ['extension' => '7z', 'fullName' => '7Z (7-Zip Compressed File)'],
            ['extension' => 'tar', 'fullName' => 'TAR (Tape Archive)'],
            ['extension' => 'gz', 'fullName' => 'GZ (Gzip Compressed File)'],
            ['extension' => 'iso', 'fullName' => 'ISO (Disc Image File)'],
            ['extension' => 'dmg', 'fullName' => 'DMG (Apple Disk Image)'],
            ['extension' => 'lzh', 'fullName' => 'LZH (Lempel-Ziv-Huffman Compressed File)'],
            ['extension' => 'cab', 'fullName' => 'CAB (Windows Cabinet File)'],
        ],
    ],
    [
        'category' => 'Audio',
        'formats' => [
            ['extension' => 'mp3', 'fullName' => 'MP3 (MPEG Audio Layer III)'],
            ['extension' => 'wav', 'fullName' => 'WAV (Waveform Audio File Format)'],
            ['extension' => 'ogg', 'fullName' => 'OGG (Ogg Vorbis Audio)'],
            ['extension' => 'flac', 'fullName' => 'FLAC (Free Lossless Audio Codec)'],
            ['extension' => 'wma', 'fullName' => 'WMA (Windows Media Audio)'],
            ['extension' => 'aiff', 'fullName' => 'AIFF (Audio Interchange File Format)'],
            ['extension' => 'alac', 'fullName' => 'ALAC (Apple Lossless Audio Codec)'],
            ['extension' => 'dsd', 'fullName' => 'DSD (Direct Stream Digital)'],
        ],
    ],
    [
        'category' => 'Video',
        'formats' => [
            ['extension' => 'mp4', 'fullName' => 'MP4 (MPEG-4 Part 14)'],
            ['extension' => 'avi', 'fullName' => 'AVI (Audio Video Interleave)'],
            ['extension' => 'mov', 'fullName' => 'MOV (QuickTime Movie)'],
            ['extension' => 'mkv', 'fullName' => 'MKV (Matroska Video)'],
            ['extension' => 'wmv', 'fullName' => 'WMV (Windows Media Video)'],
            ['extension' => 'mpeg', 'fullName' => 'MPEG (Moving Picture Experts Group)'],
            ['extension' => 'm4v', 'fullName' => 'M4V (MPEG-4 Video File)'],
            ['extension' => '3gp', 'fullName' => '3GP (3rd Generation Partnership Project)'],
            ['extension' => 'swf', 'fullName' => 'SWF (Shockwave Flash)'],
        ],
    ],
    [
        'category' => 'CAD Files',
        'formats' => [
            ['extension' => 'dwg', 'fullName' => 'DWG (AutoCAD Drawing)'],
            ['extension' => 'dxf', 'fullName' => 'DXF (Drawing Exchange Format)'],
        ],
    ],
    [
        'category' => 'Font Files',
        'formats' => [
            ['extension' => 'ttf', 'fullName' => 'TTF (TrueType Font)'],
            ['extension' => 'otf', 'fullName' => 'OTF (OpenType Font)'],
        ],
    ],
    [
        'category' => 'Ebooks',
        'formats' => [
            ['extension' => 'epub', 'fullName' => 'EPUB (Electronic Publication)'],
            ['extension' => 'fb2', 'fullName' => 'FB2 (FictionBook 2.0)'],
            ['extension' => 'lit', 'fullName' => 'LIT (Microsoft Reader eBook)'],
            ['extension' => 'lrf', 'fullName' => 'LRF (Sony Portable Reader File)'],
        ],
    ],
    [
        'category' => 'Web',
        'formats' => [
            ['extension' => 'html', 'fullName' => 'HTML (Hypertext Markup Language)'],
            ['extension' => 'css', 'fullName' => 'CSS (Cascading Style Sheets)'],
            ['extension' => 'js', 'fullName' => 'JS (JavaScript)'],
            ['extension' => 'xml', 'fullName' => 'XML (Extensible Markup Language)'],
            ['extension' => 'json', 'fullName' => 'JSON (JavaScript Object Notation)'],
            ['extension' => 'xhtml', 'fullName' => 'XHTML (Extensible Hypertext Markup Language)'],
        ],
    ],
    [
        'category' => 'Programming',
        'formats' => [
            ['extension' => 'py', 'fullName' => 'PY (Python Source Code)'],
            ['extension' => 'java', 'fullName' => 'JAVA (Java Source Code)'],
            ['extension' => 'cpp', 'fullName' => 'CPP (C++ Source Code)'],
            ['extension' => 'go', 'fullName' => 'GO (Go Source Code)'],
            ['extension' => 'kt', 'fullName' => 'KT (Kotlin Source Code)'],
            ['extension' => 'r', 'fullName' => 'R (R Script)'],
            ['extension' => 'swift', 'fullName' => 'SWIFT (Swift Source Code)'],
            ['extension' => 'scala', 'fullName' => 'SCALA (Scala Source Code)'],
            ['extension' => 'jsx', 'fullName' => 'JSX (JavaScript XML)'],
            ['extension' => 'php', 'fullName' => 'PHP (PHP: Hypertext Preprocessor)'],
        ],
    ],
];
?>

Usage Example PHP Array

Here is a quick example of how you might use this array to generate an HTML select option

PHP
<?php
$html = '';
foreach ($fileFormats as $group) {
    $html .= '<optgroup label="' . htmlspecialchars($group['category']) . '">';

    foreach ($group['formats'] as $option) {
        $value = strtolower($option['extension']);
        $text = htmlspecialchars($option['fullName']);
        $html .= '<option value="' . $value . '">' . $text . '</option>'.PHP_EOL;
    }

    $html .= '</optgroup>'.PHP_EOL;
}
?>

<select id="file-format">
  <?php echo $html ?>
</select>

JavaScript and PHP keep the grouping structure intact in both arrays. This setup simplifies data manipulation through programming. You can use this array to

  • Dynamically generate HTML select elements

  • Filter file formats by category

  • Search for specific file formats

  • Creating a file format validation function