note 85420 deleted from function.substr by googleguy
| From: | googleguy@php.net | Date: | Tue, 16 Oct 2012 11:56:52 +0000 |
| Subject: | note 85420 deleted from function.substr by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191327@lists.php.net to get a copy of this message | ||
Note Submitter: baldaris69 at yahoo dot com
----
***Caution newbie***
To extract a file Extension this fuction could be useful.
<?php
$file_extension = substr($filename , strrpos($filename , '. ') +1);
?>
Suppose your file name is Baldaris.jpeg
strrpos will return the last dot position in the string 9 so
so the compiler will execute substr($filename , 10)
$file_extension will have value jpeg
pretty cool...
Cheer's
Baldaris