eyalros Posted December 23, 2007 Share Posted December 23, 2007 Hello! I have a string like that: "XXX, XXX, XXX, " How can I remove the last ", " ? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/82907-solved-remove-the-last-from-a-string/ Share on other sites More sharing options...
Barand Posted December 23, 2007 Share Posted December 23, 2007 www.php.net/trim Specify ", " as chars to be removed. Another method is to store the 'XXX' in an array then join(', ', $array) to eliminate the trailing comma in the first place. Quote Link to comment https://forums.phpfreaks.com/topic/82907-solved-remove-the-last-from-a-string/#findComment-421649 Share on other sites More sharing options...
eyalros Posted December 23, 2007 Author Share Posted December 23, 2007 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/82907-solved-remove-the-last-from-a-string/#findComment-421653 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.