HTMLSPECIALCHARS array elements in PHP

I load the file with an array

$tool = array(
   'site_name'=>',      <title>',
);

When displaying a tag & lt; Title & gt; Not displayed, but processed as HTML tag. How are all the $ tool array elements to skip through the HTMLSPecialChars () function?


Answer 1, Authority 100%

If you just run all elements, then:

foreach ($tool as &$t){
   $t=htmlspecialchars($t);
}

Answer 2

If you need to handle HTML code, as ordinary text, I advise you to use the HTMLENTIES () and For reverse decoding – HTMLENTIES () HTML_Entity_Decode () HTMLENTIES ()

Thus, run all the elements of the array in the cycle foreach ()

p.s The second parameter of both functions should be “ent_quotes

Leave a reply

Please enter your comment!
Please enter your name here