3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<< STR <div> <p>At the time of creating any blog or news based websites most webmasters gives the least amount of importance to the commenting system of their website, without even understanding the importance of it. Eventually comment section of a website is the only place where people interact with the author when they are exited or happy with the article and helps to grow the whole website community. In most cases they end up using some third party commenting system like Disqus or Spot.im etc. without even realizing what a blunder they are making. I’ve seen many websites (both big & popular as well as small websites) using Disqus commenting system, without even realizing the consequences. And by the time you will realize it, your site would have become so big & popular they you can’t take the risk of changing your commenting system. If you are thinking why, keep reading.</p> <p><a href="I want to omit this P from counting"><img src="I want to omit this p from counting" /></a></p> <p>As creating websites has become very easy now-a-days many non-techy people can make a websites too, but they don’t get the insights of an experienced personal. Before writing this article I’ve used disqus for months to research it thoroughly and at the same time I’ve also tried Spot.im (a new player in this arena) but in both cases I’ve come up with the same conclusion. Never ever use these third party commenting system on your website. Here are the 7 facts about Disqus and similar commenting system for which I will suggest you to stay away from them.</p> <p><a href="I want to omit this P from counting"><img src="I want to omit this p from counting" /></a></p> <p>As creating websites has become very easy now-a-days many non-techy people can make a websites too, but they don’t get the insights of an experienced personal. Before writing this article I’ve used disqus for months to research it thoroughly and at the same time I’ve also tried Spot.im (a new player in this arena) but in both cases I’ve come up with the same conclusion. Never ever use these third party commenting system on your website. Here are the 7 facts about Disqus and similar commenting system for which I will suggest you to stay away from them.</p> </div> STR; $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'); $paragraphNumber = 1; libxml_use_internal_errors(true); $dom = new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); $paragraphs = $xpath->query('//p[not(ancestor::div[contains(@class, \'callout\') or contains(@class, \'callin\')] or ancestor::pre or ancestor::code or a/img)]'); if ($paragraphs->length > $paragraphNumber) { $script = <<< STR <span> <script>alert('hello');</script> </span> STR; $newDom = new DOMDocument; $newDom->loadHTML($script, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $node = $newDom->getElementsByTagName('span')->item(0); $adNode = $dom->importNode($node, true); $paragraphs->item($paragraphNumber)->parentNode->insertBefore($adNode, $paragraphs->item($paragraphNumber)); } libxml_use_internal_errors(false); echo $dom->saveHTML();
Output for 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Deprecated: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /in/iUWj4 on line 19 <div> <p>At the time of creating any blog or news based websites most webmasters gives the least amount of importance to the commenting system of their website, without even understanding the importance of it. Eventually comment section of a website is the only place where people interact with the author when they are exited or happy with the article and helps to grow the whole website community. In most cases they end up using some third party commenting system like Disqus or Spot.im etc. without even realizing what a blunder they are making. I&rsquo;ve seen many websites (both big &amp; popular as well as small websites) using Disqus commenting system, without even realizing the consequences. And by the time you will realize it, your site would have become so big &amp; popular they you can&rsquo;t take the risk of changing your commenting system. If you are thinking why, keep reading.</p> <p><a href="I%20want%20to%20omit%20this%20P%20from%20counting"><img src="I%20want%20to%20omit%20this%20p%20from%20counting"></a></p> <span> <script>alert('hello');</script> </span><p>As creating websites has become very easy now-a-days many non-techy people can make a websites too, but they don&rsquo;t get the insights of an experienced personal. Before writing this article I&rsquo;ve used disqus for months to research it thoroughly and at the same time I&rsquo;ve also tried Spot.im (a new player in this arena) but in both cases I&rsquo;ve come up with the same conclusion. Never ever use these third party commenting system on your website. Here are the 7 facts about Disqus and similar commenting system for which I will suggest you to stay away from them.</p> <p><a href="I%20want%20to%20omit%20this%20P%20from%20counting"><img src="I%20want%20to%20omit%20this%20p%20from%20counting"></a></p> <p>As creating websites has become very easy now-a-days many non-techy people can make a websites too, but they don&rsquo;t get the insights of an experienced personal. Before writing this article I&rsquo;ve used disqus for months to research it thoroughly and at the same time I&rsquo;ve also tried Spot.im (a new player in this arena) but in both cases I&rsquo;ve come up with the same conclusion. Never ever use these third party commenting system on your website. Here are the 7 facts about Disqus and similar commenting system for which I will suggest you to stay away from them.</p> </div>
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
<div> <p>At the time of creating any blog or news based websites most webmasters gives the least amount of importance to the commenting system of their website, without even understanding the importance of it. Eventually comment section of a website is the only place where people interact with the author when they are exited or happy with the article and helps to grow the whole website community. In most cases they end up using some third party commenting system like Disqus or Spot.im etc. without even realizing what a blunder they are making. I&rsquo;ve seen many websites (both big &amp; popular as well as small websites) using Disqus commenting system, without even realizing the consequences. And by the time you will realize it, your site would have become so big &amp; popular they you can&rsquo;t take the risk of changing your commenting system. If you are thinking why, keep reading.</p> <p><a href="I%20want%20to%20omit%20this%20P%20from%20counting"><img src="I%20want%20to%20omit%20this%20p%20from%20counting"></a></p> <span> <script>alert('hello');</script> </span><p>As creating websites has become very easy now-a-days many non-techy people can make a websites too, but they don&rsquo;t get the insights of an experienced personal. Before writing this article I&rsquo;ve used disqus for months to research it thoroughly and at the same time I&rsquo;ve also tried Spot.im (a new player in this arena) but in both cases I&rsquo;ve come up with the same conclusion. Never ever use these third party commenting system on your website. Here are the 7 facts about Disqus and similar commenting system for which I will suggest you to stay away from them.</p> <p><a href="I%20want%20to%20omit%20this%20P%20from%20counting"><img src="I%20want%20to%20omit%20this%20p%20from%20counting"></a></p> <p>As creating websites has become very easy now-a-days many non-techy people can make a websites too, but they don&rsquo;t get the insights of an experienced personal. Before writing this article I&rsquo;ve used disqus for months to research it thoroughly and at the same time I&rsquo;ve also tried Spot.im (a new player in this arena) but in both cases I&rsquo;ve come up with the same conclusion. Never ever use these third party commenting system on your website. Here are the 7 facts about Disqus and similar commenting system for which I will suggest you to stay away from them.</p> </div>
Output for 5.1.0 - 5.1.1, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Notice: Use of undefined constant LIBXML_HTML_NOIMPLIED - assumed 'LIBXML_HTML_NOIMPLIED' in /in/iUWj4 on line 23 Notice: Use of undefined constant LIBXML_HTML_NODEFDTD - assumed 'LIBXML_HTML_NODEFDTD' in /in/iUWj4 on line 23 Warning: DOMDocument::loadHTML() expects exactly 1 parameter, 2 given in /in/iUWj4 on line 23
Output for 5.1.2
Notice: Use of undefined constant LIBXML_HTML_NOIMPLIED - assumed 'LIBXML_HTML_NOIMPLIED' in /in/iUWj4 on line 24 Notice: Use of undefined constant LIBXML_HTML_NODEFDTD - assumed 'LIBXML_HTML_NODEFDTD' in /in/iUWj4 on line 24 Warning: DOMDocument::loadHTML() expects exactly 1 parameter, 2 given in /in/iUWj4 on line 24
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function libxml_use_internal_errors() in /in/iUWj4 on line 21
Process exited with code 255.
Output for 4.4.3 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/iUWj4 on line 34
Process exited with code 255.
Output for 4.4.2
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/iUWj4 on line 36
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/iUWj4 on line 34
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/iUWj4 on line 34
Process exited with code 255.

preferences:
333.6 ms | 401 KiB | 467 Q