HTML entity decode to original displayed characters in PHP

Recently I faced problem while fetching data from some websites and putting it in my database. Problem was that when I fetch data I got some special characters encoded like below

  1. character displayed was ‘ but I got ‘ when I fetch using simplehtmldom
  2. character displayed was ’ but I got ’ when I fetch using simplehtmldom

After searching for more then 8 hours I got a very simple and straight forward solution to convert there characters back to the original displayed characters: Keep on reading