setMatchThreshold($data['matchThreshold']);
}
$diff->setUseTableDiffing($useTableDiffing);
$diffOutput = $diff->build();
$diffOutput = iconv('UTF-8', 'UTF-8//IGNORE', $diffOutput);
$jsonOutput = json_encode(array('diff' => $diffOutput, 'debug' => $debugOutput));
if (false === $jsonOutput) {
throw new \Exception('Failed to encode JSON: '.json_last_error_msg());
}
echo $jsonOutput;
} else {
header('Content-Type: text/html');
echo file_get_contents('demo.html');
}