Created
October 14, 2013 14:26
-
-
Save matthewpoer/6976508 to your computer and use it in GitHub Desktop.
Return the file name from a provided $url. URL should be absolute.
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
/** | |
* Return the file name from a provided $url | |
* | |
* URL structure should be absolute, e.g. | |
* http://site.example.com/path/file_name_to_find.ext | |
* | |
* @param $url string | |
* @return string | |
*/ | |
function grab_filename_from_url($url){ | |
$a = explode('/',$url); | |
return $a[count($a)-1]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
return basename($url) is better