smerny Posted September 30, 2009 Share Posted September 30, 2009 I used this: trim($value,"\0"); expecting that it would trim 0's off the ends... but i got the result: 2aaaaaaaa.aaaaaaaaaaa0 which has a 0 at one of the ends... Question: what did I do wrong? Quote Link to comment https://forums.phpfreaks.com/topic/176122-solved-trim-0s-off-the-ends/ Share on other sites More sharing options...
cags Posted September 30, 2009 Share Posted September 30, 2009 So near, yet so far trim($value,"0"); Quote Link to comment https://forums.phpfreaks.com/topic/176122-solved-trim-0s-off-the-ends/#findComment-928044 Share on other sites More sharing options...
RussellReal Posted September 30, 2009 Share Posted September 30, 2009 yeah, \0 is the nulbyte and 0 is just a simple 0 Quote Link to comment https://forums.phpfreaks.com/topic/176122-solved-trim-0s-off-the-ends/#findComment-928045 Share on other sites More sharing options...
smerny Posted September 30, 2009 Author Share Posted September 30, 2009 cags lol, been busy? Posts: 97 (97 per day) thanks though Quote Link to comment https://forums.phpfreaks.com/topic/176122-solved-trim-0s-off-the-ends/#findComment-928050 Share on other sites More sharing options...
cags Posted October 1, 2009 Share Posted October 1, 2009 Technically that was 97 over 2 days... but no I've not been busy, hence the fact I've spent so much time on the forums, lol. Boredom. Can you set the topic to solved if your sorted?! Quote Link to comment https://forums.phpfreaks.com/topic/176122-solved-trim-0s-off-the-ends/#findComment-928307 Share on other sites More sharing options...
salathe Posted October 1, 2009 Share Posted October 1, 2009 Note that if you only want the zeros to be trimmed off of the end of the string, then you should really be using the rtrim function instead trim (the latter trims from both sides). Quote Link to comment https://forums.phpfreaks.com/topic/176122-solved-trim-0s-off-the-ends/#findComment-928340 Share on other sites More sharing options...
smerny Posted October 1, 2009 Author Share Posted October 1, 2009 both ends is what i wanted, thanks Quote Link to comment https://forums.phpfreaks.com/topic/176122-solved-trim-0s-off-the-ends/#findComment-928367 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.