- htmlentities: documentation ( source)
- htmlspecialchars: documentation ( source)
<?php
$text = 'asdf&ddddd"fancy˝quotes˝';
echo htmlspecialchars($text, ENT_COMPAT | ENT_HTML401, 'UTF-8') . "\n";
// Output: asdf&ddddd"fancyË
echo htmlentities($text, ENT_COMPAT | ENT_HTML401, 'UTF-8') . "\n";
// Output: asdf&ddddd"fancyËquotes