|
|
|
|
|
<?
/* 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 | |
| |
| |
|