wmguk Posted March 16, 2008 Share Posted March 16, 2008 hey, I have a string ../../clients/trial/KW-07-05-002.jpg and i want to just get KW-07-05-002 so i need to remove the .jpg and everything including the 4th / is there anything that would do this? I was showed some code earlier for just using 3 letters out of a string, but i cant get that to work for this... Link to comment https://forums.phpfreaks.com/topic/96346-is-there-anyway-to-remove-everything-before-the-4th-in-a-string/ Share on other sites More sharing options...
wmguk Posted March 16, 2008 Author Share Posted March 16, 2008 nevermind, just sorted with substr Link to comment https://forums.phpfreaks.com/topic/96346-is-there-anyway-to-remove-everything-before-the-4th-in-a-string/#findComment-493165 Share on other sites More sharing options...
Barand Posted March 16, 2008 Share Posted March 16, 2008 <?php $path = '../../clients/trial/KW-07-05-002.jpg'; echo basename($path); //--> KW-07-05-002.jpg ?> Link to comment https://forums.phpfreaks.com/topic/96346-is-there-anyway-to-remove-everything-before-the-4th-in-a-string/#findComment-493236 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.