title: php pdo and html entity decode
body: <p>The data was inserted into the database after being escaped as follows:</p>
  
  <pre><code>$caller=htmlentities($formVarsI['caller'], ENT_QUOTES, "UTF-8");
  </code></pre>
  
  <p>Some of the $caller's have single quotes e.g. O'Connor and these then look like O<code>&amp;#039;</code>Connor in the database.</p>
  
  <p>I am now trying to extract the data using a REST api and below is my php:</p>
  
  <pre><code>$sql = "SELECT caller FROM tbl_calls ";
  try {
      $db = getConnection();
      $stmt = $db-&gt;query($sql);  
      $calls= $stmt-&gt;fetchAll(PDO::FETCH_OBJ);
      $db = null;
      echo json_encode($calls);
      }
  </code></pre>
  
  <p>My question is how to html_entity_decode on $caller so as to remove the </p>
  
  <pre><code>&amp;#039;
  </code></pre>
  
  <p>for each caller where it applies.  Note there are approx. 10,000 entries in the db.</p>