From 2566e04ebf81c856dec778fef3aa10f0eaa8b5ce Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 8 May 2005 22:43:16 +0000 Subject: [PATCH] Added fetch_extension() method --- functions.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/functions.php b/functions.php index 9ab65b0..87f2300 100644 --- a/functions.php +++ b/functions.php @@ -409,6 +409,18 @@ class Functions list ($endtime['micro'], $endtime['sec']) = explode(' ', $mtend); return ($endtime['micro'] + $endtime['sec']) - ($starttime['micro'] + $starttime['sec']); } + + /** + * Fetches the extension of a file by extracting everything after the last period + * + * @param str Filename + * + * @return str The extension for the specifid file name + */ + function fetch_extension($filename) + { + return strval(end(explode('.', $filename))); + } } /*=====================================================================*\ -- 2.22.5