dmccabe Posted March 11, 2008 Share Posted March 11, 2008 Can anyone point me in the right direction of how I can remove the last 4 characters of a string. So "filename.txt" would become "filename" Thanks! Link to comment https://forums.phpfreaks.com/topic/95638-remove-the-last-4-characters-of-a-string/ Share on other sites More sharing options...
trq Posted March 11, 2008 Share Posted March 11, 2008 substr(). Link to comment https://forums.phpfreaks.com/topic/95638-remove-the-last-4-characters-of-a-string/#findComment-489616 Share on other sites More sharing options...
redarrow Posted March 11, 2008 Share Posted March 11, 2008 <?php $name="redarrow.txt"; $result=substr($name,0,-4); echo $result; ?> Link to comment https://forums.phpfreaks.com/topic/95638-remove-the-last-4-characters-of-a-string/#findComment-489622 Share on other sites More sharing options...
dmccabe Posted March 11, 2008 Author Share Posted March 11, 2008 Thank you once again good sir! Link to comment https://forums.phpfreaks.com/topic/95638-remove-the-last-4-characters-of-a-string/#findComment-489629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.