|
|
|
| <?php
function remove_extension($filename) {
return preg_replace('/(.+)\..*$/', '$1', $filename);
}
?> | |
Example Usage
| <?php
// Prints 'header'
echo remove_extension("header.php");
?> | |
To see an exmaple of how to get the extension instead of the file name :
http://www.weberdev.com/get_example-4609.html |
|
| Newbie Notes #7 - Ridiculous regex Categories : PHP, Beginner Guides, Regexps | | | Validating a URL with preg_match Categories : PHP, Regexps, Beginner Guides, Data Validation | | | Check if a file exists on a remote FTP server with PHP Categories : PHP, FTP, Regexps | | | Find the day of the week for any given year/month/day. Categories : PHP, Date Time, Data Validation, Algorithms, Beginner Guides | | | Upload Via FTP - an alternative to move_uploaded_file Categories : PHP, FTP, Beginner Guides | | | Calculate Body Mass Index Categories : PHP, Algorithms, Regexps | | | How to strip non-alpha characters from a string Categories : Regexps, PHP | | | PHP and javascript mouseover, mouseout, and mousedown events Categories : PHP, Java Script, Form Processing, Beginner Guides | | | How to preset a text string in a textarea input field Categories : HTML, HTML and PHP, PHP, Beginner Guides | | | How to check if a string has only specific characters?
Categories : PHP, Regexps | | | Easy alert box pop-up function Categories : PHP, Java Script, Beginner Guides | | | Newbie Notes #1 - Making a form return to itself Categories : PHP, Beginner Guides, HTML and PHP | | | Specify your connection settings and create a link to a MySQL database. Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides | | | mySQL/PHP/search with multientry
form and table output with colored rows Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases | | | php table decoder used to convert an html table to individual tokens
through regular expressions Categories : PHP, Regexps, HTML and PHP | |
|
|
|