Jump to content

find tags in a string


mike1313

Recommended Posts

I want to be able to take a string and find out if they used a < b > tag. If that tag is used and the closing tag isn't </ b >. Then it adds it to the string.

 

For ex.

$string = "<b>Hi.";
$add .="</b>";
$newstringafterwouldbe = "<b>Hi.</b>";

 

Just pointing me in the right direction on which function/s to use would be very helpful.

Link to comment
https://forums.phpfreaks.com/topic/83780-find-tags-in-a-string/
Share on other sites

No. The string will be users input and I'm allowing <B><U><I><S> only. What they post gets displayed on the page and I dont want them doing.

 

<B><S>What's up?

 

Without including the closing </B></S>, because in most cases it will mess things up.

Link to comment
https://forums.phpfreaks.com/topic/83780-find-tags-in-a-string/#findComment-426293
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.