3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = '<body> I want to acquire only "text excluding HTML tag" included in this part. <script language="JavaScript" type="text/javascript"> var foo = 42; </script> </body>'; $dom = new DOMDocument(); $dom->loadHTML($x); $script = $dom->getElementsByTagName('script')->item(0); $script->parentNode->removeChild($script); $body = $dom->getElementsByTagName('body')->item(0); echo $body->nodeValue;
Output for 8.0.30, 8.1.22 - 8.1.33, 8.2.9 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.15, 8.5.0
I want to acquire only "text excluding HTML tag" included in this part.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.29, 8.1.0 - 8.1.21, 8.2.0 - 8.2.8
I want to acquire only "text excluding HTML tag" included in this part.

preferences:
126.56 ms | 408 KiB | 5 Q