How to get each file's extension in a given folder in PHP on Windows XP?
<p>E.g:</p>

<p>folder name:</p>

<pre><code>myFonlder
</code></pre>

<p>files in myFolder</p>

<pre><code>myFolder.01.mkv
myFolder.02.mkv
myFolder.03.avi
myFolder.04.mts 
...

// each file's extension may be different.
</code></pre>

<p>So,how can I extract the extension of each file?</p>

<p>Thank you very much!!</p>

<p><strong>[update]</strong></p>

<p>my own solution; want to know is it fast enough!?</p>

<pre><code>foreach (glob("d:\\myFolder\\*.*") as $filename) {
    //echo "$filename size " . filesize($filename) . "\n";

    $path_parts = pathinfo($filename);

    echo $path_parts['dirname'], "\n";
    echo $path_parts['basename'], "\n";
    echo $path_parts['extension'], "\n";
    echo $path_parts['filename'], "\n"; // since PHP 5.2.0
}
</code></pre>
