View Full Version : HTML killer in PHP
Daniel Hollands
February 1st, 2001, 17:37
Is the a function in PHP to remove all HTML tabs from an input box?
I believe there is, but I can't remember what, or how I would use it.
Thanx.
Koolguy
February 1st, 2001, 17:48
$whatever=preg_replace ("/<.*?>/", "", $whatever);
Daniel Hollands
February 1st, 2001, 18:02
Thank you very much, everyone here has been very helpful with all my problems.
Daniel Hollands
February 1st, 2001, 18:12
Hi there, I'm sorry to say this, but this command is not working, I think it's pulling away some of the HTML, but not all of it.
Any ideas????
Koolguy
February 1st, 2001, 18:12
hmm, let me check over the code
Daniel Hollands
February 1st, 2001, 18:30
sorted
thank you.
Woofcat
February 1st, 2001, 21:16
Originally posted by Koolguy
$whatever=preg_replace ("/<.*?>/", "", $whatever);
That would be the Perl way. Regular expressions are inefficient and as such PHP provides much faster alternatives for most situations.
The optimal solution is
$whatever=strip_tags($whatever);
Koolguy
February 1st, 2001, 22:52
Cool, never knew that one.
Daniel Hollands
February 2nd, 2001, 15:30
so you suggest that I use:
$whatever=strip_tags($whatever);
I'll give it a go, thank you :-)
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.