remove all text between 2 values in a 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
pcaines2
Forum Newbie
Posts: 1
Joined: Sun Mar 14, 2010 10:10 am

remove all text between 2 values in a string

Post by pcaines2 »

Hello All,

I want to remove all text between 2 values.

e.g: [pdf]remove text[-pdf]

displays

[pdf][-pdf]

I have tried everything and can't seem to get it to work.

Any help is appreciated

Thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: remove all text between 2 values in a string

Post by Christopher »

Look at the documentation for preg_replace().
(#10850)
Post Reply