With quotes:
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new; // <a href='test'>Test</a>
Without quotes:
$new = htmlspecialchars("<a href='test'>Test</a>");
echo $new; // <a href='test'>Test</a>
The second parameter possible values:
ENT_COMPAT
- Will convert double-quotes and leave single-quotes alone.
ENT_QUOTES
- Will convert both double and single quotes.
ENT_NOQUOTES
- Will leave both double and single quotes unconverted.
The default is ENT_COMPAT