subtract from string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jazz090
Forum Contributor
Posts: 176
Joined: Sun Apr 12, 2009 3:29 pm
Location: England

subtract from string

Post 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?
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: subtract from string

Post 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()? :)
Post Reply