note 80395 deleted from function.filetype by philip

From: Date: Sun, 15 Jun 2008 03:15:47 +0000
Subject: note 80395 deleted from function.filetype by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140451@lists.php.net to get a copy of this message
Note Submitter: zachary.s.scott[at]gmail[dot]com ---- I find that if you're trying to get the extension of a file, this method isn't the what you want. I've written a function instead: <?php function fileExtension($file) { $fileExp = explode('.', $file); // make array off the periods $filetype = $fileExp[count($fileExp) -1]; // file extension will be last index in array, -1 for 0-based indexes } ?>

« previous php.notes (#140451) next »