function example will be the same exact code since we really should show one when demonstrating the other since they work in tandem in many applications.
$original_input = "<em>Hello Suckerbutt!</em>";
$html_encoded = htmlentities($original_input);
echo "<hr />";
$html_decoded = html_entity_decode($html_encoded);