Home>

I am trying DOM manipulation with php.

$content = '<html><body><p>hogehoge</p><p>1000<= 10000</p><p&gt ;hogehoge</p></body></html>';
$dom = new DOMDocument ();
$dom->loadHTML ($content);
return $dom->saveHTML ();


When you execute the above

<html><body><p>hogehoge</p><p>1000</p><p>hogehoge</p></body></html>


And<= and after are ignored and returned.
Is there a way to return it correctly?

php
  • Answer # 1

    $content = '1000<= 10000';
    $content = htmlspecialchars ($content);


    How about trying it?