WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Function to get the filetype from a filename. Usage: GetFileType($Filename);
Categories : PHP, Filesystem Update Picture
Olason Kjartan
Date : Dec 11th 2000
Grade : 5 of 5 (graded 1 times)
Viewed : 3618
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Olason Kjartan
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?
/* GetFileType */

function GetFiletype($Filename) {

        if (substr_count($Filename, ".") == 0) {                // Check if there is a dot

                return;                                // Return Nothing

        } else if (substr($Filename, -1) == ".") {                // Check if the string ends with .

                return;                                // Return Nothing

        } else {
                $FileType = strrchr ($Filename, ".");        // Split the string where the dot is
                $FileType = substr($FileType, 1);        // Remove the dot
                return $FileType;                        // Return the filetype
        }
}


$Filename = "Testfilename.php4";

$Filename = GetFileType($Filename);

echo $Filename;                        // This prints out php4

?>



Compare two texts and display a block of text with the differences between them.
Categories : PHP, PHP Classes, Filesystem, Strings, Arrays
Keep() - maintenance function for backup folders
Categories : PHP, Filesystem, Maintenance
Complete NotePad application for Websites (Like Yahoo Notepad)
Categories : PHP, Web Applications, Filesystem, Java Script, Complete Programs
Directory Viewer, Directory Content Viewer, Directory Structure to HTML. This code will basically create a complete set of HTMLs to let a user navigate through any directory you want. Excellent code for large file sharing pages.
Categories : Directories, Filesystem, PHP
Functions to read a template file and fill in PHP variables. It will also fill in array variables, displaying parts of the template multiple times.
Categories : PHP, Variables, Filesystem
File Explorer, browse, upload, download and edit your web site files with only a browser and a HTTP connection.
Categories : Complete Programs, Content Management, Filesystem, PHP
Checking to see if a file exists with PHP
Categories : PHP, Filesystem, Perl
A simple php file uploader
Categories : PHP, Filesystem, HTML and PHP
Massreplace
Categories : Filesystem, Regexps, Strings, PHP
Contents Page - a script to build contents pages.
Categories : Complete Programs, PHP, Utilities, Filesystem
Open directory and File download
Categories : PHP, Filesystem, Directories, HTML and PHP
3 lines of Code to extract Tar, Zip, Gzip etc..
Categories : PHP, Filesystem, PHP Classes, Compression
How to let a user download a picture by clicking on it instead of needing to right click and Save-As.
Categories : HTTP, PHP, HTML and PHP, Filesystem
Filling an array with files from any given directory. This example is for the current PHP script's directory.
Categories : PHP, Arrays, Filesystem
how can I read the entire contents of a file into a string?
Categories : Filesystem, Strings, PHP