FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » strip_tags function
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: strip_tags function [message #178741 is a reply to message #178738] Fri, 27 July 2012 06:25 Go to previous messageGo to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
El 26/07/2012 19:27, Tim Fardell escribió/wrote:
> On Thu, 26 Jul 2012 18:18:44 +0100, Tim Fardell
> <tim(dot)fardell(dot)all-your-clothes(at)virgin(dot)net> wrote:
>
>> However, am I right in thinking that the strip_tags() function simply assumes
>> that any less-than character (<) occurring within a string is the beginning of a
>> tag?
>>
>> I hope I'm wrong, because that would be completely crap and useless :-)
>
> Apologies for following-up my own post, but I just realised the answer to my own
> question.
>
> I think I am correct that strip_tags assumes any '<' character to be the
> beginning of a tag - but this doesn't actually matter, since the input string
> should be HTML encoded anyway, so all '<' characters should be escaped as '&lt;'
> - so all actual '<' characters will indeed be tags :-)
>
> So I wasn't wrong, but it's not as crap and useless as I thought!

As you've already noticed yourself, the strip_tags() function makes
sense when applied to HTML. As such, I think it's good enough, though
you won't get predictable results if the HTML is not valid (which is
normally the same that happens with web browsers).

Sadly, it's pretty often used on plain text, leading to annoyances and
data loss. Have you ever posted a comment on a programming web site,
just to find out that your code snippets were ruined by the forum? There
you are.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP to PDF
Next Topic: ncurses on Linux how to capture F1 key?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 02:53:02 GMT 2024

Total time taken to generate the page: 0.04840 seconds