Reading parts of a posted variable

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

User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

just change the regex...

Code: Select all

#<img[^>]+>#is
this will match the img tags. if you need to replace it with something just feed it to the preg_replace function
tristanlee85
Forum Contributor
Posts: 172
Joined: Fri Dec 19, 2003 7:28 am

Post by tristanlee85 »

Well, since I want to remove the images fron the signature, I figure I'd replace it with nothing, like so:

Code: Select all

$user_sig = preg_replace('#<img[^>]+>#is','',$user_sig);
Correct?
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

just try :P
tristanlee85
Forum Contributor
Posts: 172
Joined: Fri Dec 19, 2003 7:28 am

Post by tristanlee85 »

Heh, works perfectly.

Once again, thank you all.
Post Reply