unkwntech Posted August 13, 2008 Share Posted August 13, 2008 I need to identify the file name in an url, this is not the current url so I can use PHP vars, it is a string submitted from a user. This is what I have: /[a-Z0-9]*\.[a-Z0-9]{2,4} what I'm looking to get is file.ext from http://domain.tld/file.ext Link to comment https://forums.phpfreaks.com/topic/119569-identifying-filename-in-url/ Share on other sites More sharing options...
Johntron Posted August 13, 2008 Share Posted August 13, 2008 basename( $url ); Example: $url = 'http://www.johntron.com/index.php'; echo basename( $url ); // Output: index.php Link to comment https://forums.phpfreaks.com/topic/119569-identifying-filename-in-url/#findComment-616030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.