Panjabel Posted June 30, 2007 Share Posted June 30, 2007 $string = "photo.jpg"; i want to add "_t2" before the extension .jpg: like $string = "photo_t2.jpg"; can you help me please Link to comment https://forums.phpfreaks.com/topic/57865-solved-help-with-this-string-pls/ Share on other sites More sharing options...
no_one Posted June 30, 2007 Share Posted June 30, 2007 $string = str_replace('.','_t2.',$string); That should work. Link to comment https://forums.phpfreaks.com/topic/57865-solved-help-with-this-string-pls/#findComment-286724 Share on other sites More sharing options...
chocopi Posted June 30, 2007 Share Posted June 30, 2007 I was gonna suggest something similar, but that will only work if there is one "." ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/57865-solved-help-with-this-string-pls/#findComment-286726 Share on other sites More sharing options...
no_one Posted June 30, 2007 Share Posted June 30, 2007 True, but they never mentioned that they'd need it to work in cases where filename is not known. :S Link to comment https://forums.phpfreaks.com/topic/57865-solved-help-with-this-string-pls/#findComment-286728 Share on other sites More sharing options...
Panjabel Posted June 30, 2007 Author Share Posted June 30, 2007 cool Link to comment https://forums.phpfreaks.com/topic/57865-solved-help-with-this-string-pls/#findComment-286729 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.