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 : a PHP Function to Get only the filename (remove the extension) using regular expressions.
Categories : PHP, Regexps, Beginner Guides Click here to Update Your Picture
Sumit Agarwal
Date : Nov 24th 2007
Grade : 3 of 5 (graded 2 times)
Viewed : 8622
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Sumit Agarwal
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

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



Validating a URL with preg_match
Categories : PHP, Regexps, Beginner Guides, Data Validation
PHP based HTML rabbing Tools
Categories : PHP, HTML and PHP, Tag Extractors, Regexps, Beginner Guides
Newbie Notes #7 - Ridiculous regex
Categories : PHP, Beginner Guides, Regexps
Grab links from a page
Categories : PHP, Regexps, HTTP
Calculate Body Mass Index
Categories : PHP, Algorithms, Regexps
How to Insert a Date Format Into MySQL from PHP
Categories : PHP, Databases, MySQL, Date Time, Beginner Guides
Match words that are entered into a <textarea> in any layout orientation (horizontal, vertical, diagonal).
Categories : PHP, Regexps
My Box - PHP Class that calculates the volumetric weight of a package.
Categories : PHP, Object Oriented, PHP Classes, Beginner Guides, Payment Gateways
Random text quote
Categories : PHP, Arrays, Beginner Guides
An array of functions to use in checking user input to HTML forms : text, firstName, middleNameOrInit, lastName, email, web, digits, decimal, hex, genNum, USD, BPS, Euro, USphone, USzip
Categories : PHP, Data Validation, Regexps
Creating a Language File
Categories : PHP, Beginner Guides, Filesystem
session out Timer
Categories : PHP, Sessions, Security, Beginner Guides
Human readable PHP password generator
Categories : PHP, Security, Beginner Guides, Arrays
making links from text
Categories : PHP, Regexps, Email
Banknote Validation - A PHP class that provides several methods to quickly validate banknote serial numbers of the following currencies: AUD, CAD, CHF, CNY, EUR, GBP, JPY, USD.
Categories : PHP, PHP Classes, Data Validation, Regexps