Skip to content

Instantly share code, notes, and snippets.

@GoldenEra
Created May 5, 2015 04:17
Show Gist options
  • Save GoldenEra/65bf1c93b9f011590cc1 to your computer and use it in GitHub Desktop.
Save GoldenEra/65bf1c93b9f011590cc1 to your computer and use it in GitHub Desktop.
php: get suffix from a given file name
/**
* get suffix from a given file_name
*
* @since [1.0]
* @see [filetype()]
* @author Richard
* @date 2015-05-05
*
* @param [string] $file_name [a.txt]
* @return [sring] [txt]
*/
function file_suffix($file_name)
{
return substr($file_name, strrpos($file_name, '.') - strlen($file_name) + 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment