You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
412 B
18 lines
412 B
<?php
|
|
|
|
# Returns the extension of the filename (path or URI) or an empty string
|
|
function getExtension($filename, $isURI = false) {
|
|
|
|
# If $filename is an URI, get only the path component
|
|
if ($isURI)
|
|
$filename = parse_url($filename, PHP_URL_PATH);
|
|
|
|
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
|
|
|
if (!empty($extension))
|
|
$extension = '.' . $extension;
|
|
|
|
return $extension;
|
|
}
|
|
|
|
?>
|