PhpTips.im - Everything about php - Download CMS, find tips and tricks, code snippetz, classes and more and more...
Bookmark this page !
   

Articles

    Home » Articles » PHP Snippets » Get file extension
Published on : 15.05.2010 Category : PHP Snippets Viewed : 59 times.

Code:


  1. function getExtension($filename)
  2. {
  3. return ('.' . ($ext = pathinfo($filename, PATHINFO_EXTENSION)) == $filename) ? null : $ext;
  4. }
  5.  
  6. // Example:
  7. var_dump(getExtension('.htaccess'), getExtension('image.jpg'));
  8. // Result:
  9. // NULL
  10. // string(3) "jpg"



Add this article in :

 

There is not yet any comment !



1087 Rating: 0.0/10 (0 votes cast)

 

 Members
Log In !
Email Address :

Password :


Change my passowrd !
Sign Up !
We have : 3 members.
Latest member : albans
 
 Last Posts
 
 Advertising
 
©PhpTips.im 2010
Powered by PikaCMS.
Quick Links :
Home | Browse all articles | Downloads | Terms of Use
RSS RSS 2.0 : Articles | Downloads ATOM : Articles | Downloads