Revision: 20313
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 11, 2009 20:51 by kirik
Initial Code
function getExtension($filename) { return ('.' . ($ext = pathinfo($filename, PATHINFO_EXTENSION)) == $filename) ? null : $ext; } // Example: var_dump(getExtension('.htaccess'), getExtension('image.jpg')); // Result: // NULL // string(3) "jpg"
Initial URL
Initial Description
This function works correct with files with no extension.
Initial Title
Get file extension
Initial Tags
file, extension
Initial Language
PHP