note 85420 added to function.substr
| From: | baldaris69 at yahoo dot com | Date: | Fri, 29 Aug 2008 07:57:24 +0000 |
| Subject: | note 85420 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143969@lists.php.net to get a copy of this message | ||
***Caution newbie***
To extract a file Extension this fuction could be useful.
$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
----
Server IP: 203.199.69.133
Probable Submitter: 118.95.14.75
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/85420
Del: integrated -- https://master.php.net/note/delete/85420/integrated
Del: useless -- https://master.php.net/note/delete/85420/useless
Del: bad code -- https://master.php.net/note/delete/85420/bad+code
Del: spam -- https://master.php.net/note/delete/85420/spam
Del: non-english -- https://master.php.net/note/delete/85420/non-english
Del: in docs -- https://master.php.net/note/delete/85420/in+docs
Del: other reasons-- https://master.php.net/note/delete/85420
Reject -- https://master.php.net/note/reject/85420
Search -- https://master.php.net/manage/user-notes.php