Get filename extension
Posted on July 15, 2008, under PHP,
Bookmark it
This snippet can help you to get the extension of a filename:
<?php ... some code here ... // Filename $filename = 'public_html/root/internet.gif'; // Extension $ext = strrchr($filename, "."); echo $ext; // will return ".gif" ?>
- July 15, 2008
- article by Gabriel C.
- 1 comment
-
May 21, 2008
Validate numeric string
Check if a string is numeric or not.
-
May 21, 2008
PHP: How to validate e-mail addresses using regular expressions
This function checks if an email address is valid or not. For example it is very useful if you have to validate a html form where someone should enter a real email address.
-
May 21, 2008
PHP: Get filename of the currently executing script
Using this piece of code you will get the filename of the currently executing script without containing the full path to it. For instance if $_SERVER['PHP_SELF'] is equal with /public_html/web/login.php our code will return only login.php $self = basename($_SERVER['PHP_SELF']);
-
May 21, 2008
PHP: How to remove empty values from an array
This function removes empty values from an array. This is useful if you
-
May 21, 2008
PHP: How to redirect a visitor
This function will redirect the visitor to a specific location. <?php function go($location) { header("Location: ".$location); exit; } // Location $location = ‘http://www.google.com/’; // Redirect the visitor go($location); ?>
Popular Posts
AJAX Form with CAPTCHA, Realtime Validation and PHP BackendArticle has 549 comments
How to Add Multi-language Support to a PHP WebsiteArticle has 89 comments
How to Implement a jQuery AJAX Login Form into a Modal BoxArticle has 85 comments
Dynamic Dependant DropDown List: US States & CountiesArticle has 83 comments
An AJAX (jQuery) Username Availability Checker with PHP Back-endArticle has 61 comments

