如何获得文件扩展名? [重复]

Possible Duplicate:
How to extract a file extension in PHP ?

For example if i have a path (generated by my torrent_info_gen)-

Driver Genius Professional Edition 10.0.0.526/Driver Genius Professional Edition 10.0.0.526.exe

How should i get the extension of the file in the path! I also want to have the path and filename to be shown differently in this way:

Path: (Path of the file)

Filename: (Name of the file)

Extension: (Extension of the file)

Can someone help me! Please!!!!!

Thanks in advance!

What about this:

    $str = "Driver Genius Professional Edition 10.0.0.526/Driver Genius Professional Edition 10.0.0.526.exe";

    $info  = pathinfo($str);

    var_dump($info['dirname']);
    var_dump($info['filename']);
    var_dump($info['extension']);

Gives:

string 'Driver Genius Professional Edition 10.0.0.526' (length=45)
string 'Driver Genius Professional Edition 10.0.0.526' (length=45)
string 'exe' (length=3)
$info = pathinfo($filename);

echo "Path: ".$info['dirname'];
echo "Filename: ".$info['basename'];
echo "Extension: ".$info['extension'];

Documentation on pathinfo.

the obvious solution is already posted so here is smthing different

      $file = 'C:/foo/bar/do.exe';
    echo dirname($file);
    $ext = array_pop(explode('.',$file));
    $filename = basename($file);
$filenameWithoutExtension = basename($file,'.' . $ext);

    echo $ext;
    echo $filename;