Northern Flame Posted July 13, 2007 Share Posted July 13, 2007 I got a script from the PHP Freaks Quick Codes and I was customizing it and on one of the files they included these to things: htmlspecialcharacters(...); and n12br(htmlspecialcharacters(...)); (of course without the "..." i just didnt want to retype everything) what is the difference between the first and second? Link to comment https://forums.phpfreaks.com/topic/59742-solved-htmlspecialcharacters/ Share on other sites More sharing options...
lococobra Posted July 13, 2007 Share Posted July 13, 2007 Well, first of all there is no "htmlspecialcharacters(...);" It's htmlspecialchars htmlspecialchars() Converts any character that has specific significance in HTML to a text safe equivalent... I haven't really tested it, but it looks like it's similar to htmlentities, so I'd assume it does stuff like turns < into < nl2br() adds a line break (< br>) before each newline (\n) in a string. This is particularly useful for things such as textareas, where a user may enter a bunch of text using newlines to space everything out... then php represents those newlines a "\n", which in html... means nothing. So in order to display their text in html, you have to add line breaks before each newline So draw your own conclusions... the two functions are primarily used for processing information from forms, just use whatever you need to. Link to comment https://forums.phpfreaks.com/topic/59742-solved-htmlspecialcharacters/#findComment-296941 Share on other sites More sharing options...
Northern Flame Posted July 13, 2007 Author Share Posted July 13, 2007 Well, first of all there is no "htmlspecialcharacters(...);" It's htmlspecialchars LOL sorry about that, in my head I pronounce the entire thing so thats why I typed it in that way THANKS FOR THE HELP Link to comment https://forums.phpfreaks.com/topic/59742-solved-htmlspecialcharacters/#findComment-296943 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.