Generally, character encoding is done in various ways in PHP which provides many functions to perform these conversions, onto a given input string, from one form to another. You may also like PHP htmlspecialchars_decode() Function.
Example
<?php
$str = '<a href="http://scriptsgurus.com">Go to scriptsgurus.com</a>';
echo htmlentities($str);
?>
Output
<a href="https://scriptsgurus.com">Go to scriptsgurus.com</a>