Page 1 of 1

subtract from string

Posted: Wed May 20, 2009 8:58 am
by jazz090
i got a sentance and part of the sentence and i need to remove the smaller part from it
i know str_replace but that would just leave whitespace around it and i dont want to trail the replacer with (." "), any suggestions?

Re: subtract from string

Posted: Wed May 20, 2009 9:30 am
by jayshields
What? You've got a string. You've got another string. You want to remove string 2 from string 1 if it is contained in it.

Trail the replacer? Do you know how to concatenate strings? Or use substr()? :)