treeleaf20 Posted December 4, 2009 Share Posted December 4, 2009 All, I have the two following URLs: http://photos-c.ak.fbcdn.net/photos-.../n47602684_30183939_7359.jpg http://photos-c.ak.fbcdn.net/photos-.../n38801267_31342580_3128.jpg Basically they always end in a .jpg, .gif or .png and then I always want to take it from the the .jpg, .gif or .png to the previous / So for this I'd like to grab: n38801267_31342580_3128.jpg and n47602684_30183939_7359.jpg What is the best way to do this? Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/184038-getting-filename/ Share on other sites More sharing options...
mrMarcus Posted December 4, 2009 Share Posted December 4, 2009 try: <?php $file = '/path/to/n38801267_31342580_3128.jpg'; echo pathinfo ($file, PATHINFO_FILENAME); ?> EDIT: uses pathinfo() Link to comment https://forums.phpfreaks.com/topic/184038-getting-filename/#findComment-971619 Share on other sites More sharing options...
roopurt18 Posted December 4, 2009 Share Posted December 4, 2009 basename() Link to comment https://forums.phpfreaks.com/topic/184038-getting-filename/#findComment-971639 Share on other sites More sharing options...
mrMarcus Posted December 4, 2009 Share Posted December 4, 2009 aaah, man .. my bad. thought OP was asking to strip the extension. i'm calling it a day. Link to comment https://forums.phpfreaks.com/topic/184038-getting-filename/#findComment-971641 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.