title: Converting named HTML entities to numeric HTML entities
body: <p>Is there a PHP function to convert named HTML entities into their respective numeric HTML entities?</p>
  
  <p>For example:</p>
  
  <pre><code>$str = "Oggi &amp;egrave; un bel&amp;nbsp;giorno";
  echo entities_to_unicode($str); // Oggi &amp;#232; un bel&amp;#160;giorno
  </code></pre>
  
  <p>Thanks in advance, have a nice day!</p>