What are the differences between htmlspecialchars()
and htmlentities()
. When should I use one or the other?
One small example, I needed to have 2 client names indexed in a function:
[1] => Altisoxxce Soluxxons S.à r.l.
[5] => Joxxson & Joxxson
I originally $term = get_term_by('name', htmlentities($name), 'client');
which resulted in term names that only included the ampersand array item (&) but not the accented item. But when I changed the variable setting to htmlspecialchars
both were able to run through the function. Hope this helps!