Giddy Rob Posted September 15, 2010 Share Posted September 15, 2010 Hi, I want to separate out the file name from an image url. Not sure the best way to do it? I want to basically select all text after the last / slash. eg - image.jpg would be the result from http://www.google.com/images/image.jpg What's the best way to do it? Cheers Rob Link to comment https://forums.phpfreaks.com/topic/213468-preg-match-getting-imagejpg-from-httpwwwgooglecomimagesimagejpg/ Share on other sites More sharing options...
inversesoft123 Posted September 15, 2010 Share Posted September 15, 2010 $url = "http://www.google.com/images/image.jpg "; $pice = end(explode("/", $url)); echo "$pice"; Link to comment https://forums.phpfreaks.com/topic/213468-preg-match-getting-imagejpg-from-httpwwwgooglecomimagesimagejpg/#findComment-1111288 Share on other sites More sharing options...
Zane Posted September 15, 2010 Share Posted September 15, 2010 use pathinfo().. it will return an array where you can use the "filename" key to get that. Link to comment https://forums.phpfreaks.com/topic/213468-preg-match-getting-imagejpg-from-httpwwwgooglecomimagesimagejpg/#findComment-1111351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.