Created
May 31, 2013 13:06
-
-
Save flacodirt/5684854 to your computer and use it in GitHub Desktop.
Separate name and extension of given file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Separate name and extension of given file | |
$fullFileName = 'my.example.file.ext'; | |
$fileExt = substr($fullFileName, strrpos($fullFileName, '.') + 1); | |
$fileName = str_replace("." . $fileExt, "", $fullFileName); | |
/** | |
* Results: | |
* | |
* $fileExt = ext | |
* $fileName = my.example.file | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment