I've seen alot of functions which handle the retrival of an extension of a particular filename. I, myself, always use this solution of mine:
function extension( $filename = __FILE__ ) {
$parts = explode('.', $filename);
return (strtolower($parts[(sizeof($parts) - 1)]));
}
echo extension(); // php
echo extension('.htaccess'); // htaccess
echo extension('htaccess'); // htaccess
echo extension('index.php'); // php
Is that the best and the fastest approach?