DOMDocument::loadHTML() expects parameter 2 to be long, string given when trying to use LIBXML_HTML_NOIMPLIED parameter
<p>Currently, when I use the DOMDocument object and call saveHTML() it automatically adds some html tags I do not want. I tried the solution suggested here(<a href="https://stackoverflow.com/a/31426408/3659230">https://stackoverflow.com/a/31426408/3659230</a>) and when I do I get this error:</p>

<p><em>DOMDocument::loadHTML() expects parameter 2 to be long, string given</em></p>

<pre><code>$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc-&gt;loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD);
</code></pre>

<p>Seems pretty simple but I can't seem to get it to work. I am using PHP version 5.5.3</p>