Text
|
|
|
|
<?php
/***************************************
** Title.........: Strip Extension
** Author........: David Norman <deekayen (at) deekayen [dot] net>
** Filename......: strip_extension.php
** Last changed..: 31 October 2001
** License.......: Free to use. If you find it useful
** though, feel free to buy me something
** from my wishlist :)
** http://www.amazon.com/exec/obidos/wishlist/002-4690657-2090415
***************************************/
/***************************************
** Set the filename to a variable.
** This can be derived from a fully qualified
** URL by using the basename() function
***************************************/
$text = "index.php";
/***************************************
** Assign the name of the file to a varable
** and print it.
***************************************/
$first = substr($text, 0, strrpos($text, '.'));
echo $first;
echo "<br/><br/>";
/***************************************
** Assign the file extension to a variable
** and print it.
***************************************/
$extension = substr($text, strrpos($text, '.'), strlen($text));
echo $extension;
?>
|
|
|
Usage Example
|
|
|
Rate This Script
|
|
|
|