pioneerx01 Posted March 1, 2011 Share Posted March 1, 2011 I have sen this function before but can not remember what it is or how to code it. It allows you remove only defined characters from the end of the string. I am not looking to replace any occurrence anywhere in the phrase, just the end. For example lets say I want to remove"ld!" from phrase "Hello World!" That function would return "Hello Wor" Thanks Quote Link to comment Share on other sites More sharing options...
litebearer Posted March 1, 2011 Share Posted March 1, 2011 may get you there - http://php.net/manual/pt_BR/function.substr.php Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 1, 2011 Share Posted March 1, 2011 The rtrim() function works fine for this: <?php $str = 'Hello World!'; echo rtrim($str,'ld!'); ?> Ken Quote Link to comment 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.