On 19/07/2004, at 9:22 AM, C.F. Scheidecker Antunes wrote:

Is there any easy and efficient way to separate files extention that vary in size?

Some have 3 chars after the dot, some 2, some 1, some 4, some none.

Examples:

test.zip
test.gz
test.z
test.jpeg
test.jpg
test  (no extention)


<?
$filename = "something.foo.bah.jpeg";
$bits = explode('.',$filename);
$ext = $bits[count($bits)-1];
echo $ext;
?>


--- Justin French http://indent.com.au

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to