smith.james0 Posted January 1, 2007 Share Posted January 1, 2007 I have a some text which has a lot of single and double quote marks in it.I would like to run htmlentities on it, but because the text contains both single and double quotes it doesn't work.Can anyone help, I have had a look through the manual, but i carn't anything. Quote Link to comment https://forums.phpfreaks.com/topic/32441-a-single-and-double-quote-question/ Share on other sites More sharing options...
trq Posted January 1, 2007 Share Posted January 1, 2007 What do you meen by doesn't work? Quote Link to comment https://forums.phpfreaks.com/topic/32441-a-single-and-double-quote-question/#findComment-150734 Share on other sites More sharing options...
wildteen88 Posted January 1, 2007 Share Posted January 1, 2007 Add the ENT_QUOTES constant to the function, like so:[code=php:0]$str = <<<EOFthis has " double and ' single quotes in!EOF;echo htmlentities($str, ENT_QUOTES);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32441-a-single-and-double-quote-question/#findComment-150754 Share on other sites More sharing options...
smith.james0 Posted January 1, 2007 Author Share Posted January 1, 2007 Thanks for the quick responce, thats was just what I have looking for, but is not worked out as planned so it's back to the drawing board.The plan was to pass a load of html + text the a function to highlight key search words.Thanks, Happy new yearJames Quote Link to comment https://forums.phpfreaks.com/topic/32441-a-single-and-double-quote-question/#findComment-150770 Share on other sites More sharing options...
master82 Posted January 1, 2007 Share Posted January 1, 2007 Just a quick question - Ive seen <<<EOF and EOF; many times in php scripts but still dont know what it is exactly. It seeems to works like echo and print but im sure it must do more...Anyone care to briefly explain? Quote Link to comment https://forums.phpfreaks.com/topic/32441-a-single-and-double-quote-question/#findComment-150800 Share on other sites More sharing options...
PFMaBiSmAd Posted January 1, 2007 Share Posted January 1, 2007 This is a method to delineate strings called heredoc. See this link for it's definition - http://www.php.net/manual/en/language.types.string.php Quote Link to comment https://forums.phpfreaks.com/topic/32441-a-single-and-double-quote-question/#findComment-150812 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.