3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_script_tags($html){ $dom = new DOMDocument(); $dom->loadHTML($html); $script = $dom->getElementsByTagName('script'); $remove = []; foreach($script as $item){ $remove[] = $item; } foreach ($remove as $item){ $item->parentNode->removeChild($item); } $html = $dom->saveHTML(); $html = preg_replace('#<script src(.*?)>(.*?)</script>#is', '', $html); $html = str_replace('</p></body></html>', '', $html); return $html; } $s = []; $s = []; $s[] = " <script> (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); ga('create', 'UA-XXXXX-Y', 'auto'); ga('send', 'pageview'); </script>"; $sq[] = " <script> SC.initialize({ client_id: '192.168.1.41', redirect_uri: 'https://example.com/callback' }); SC.connect().then(function () { return SC.get('/me'); }).then(function (me) { alert('Hello, ' + me.username); }); </script> <script src="https://connect.soundcloud.com/sdk/sdk-3.3.2.js"></script> <!-- Soundcloud - END -->"; $s[] = "<!-- Google Adsense - Start --> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-1234567890123456" data-ad-slot="1234567890"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <!-- Google Adsense - END -->"; $s4[]=" <!-- Youtube - Start --> <iframe id="ytplayer" type="text/html" width="720" height="405" src="https://www.youtube.com/embed/MswordkJksdNm7lc1UVf-VE" frameborder="0" allowfullscreen> <!-- Youtube - END -->" foreach($sq as $t){ echo $t.' ==> '.remove_script_tags($t)."\n"; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.2.60.0120.00617.22
8.2.50.0120.00817.35
8.2.40.0160.00017.09
8.2.30.0130.00417.25
8.2.20.0090.00917.37
8.2.10.0130.00516.88
8.2.00.0060.01017.38
8.1.190.0110.00516.88
8.1.180.0100.00716.98
8.1.170.0080.00817.11
8.1.160.0120.00416.98
8.1.150.0160.00017.25
8.1.140.0080.00816.75
8.1.130.0060.01217.00
8.1.120.0100.00517.00
8.1.110.0110.00617.13
8.1.100.0080.00816.88
8.1.90.0120.00417.00
8.1.80.0080.00817.35
8.1.70.0150.00017.10
8.1.60.0120.00617.25
8.1.50.0070.01017.13
8.1.40.0140.00417.38
8.1.30.0080.00817.37
8.1.20.0150.00517.38
8.1.10.0110.00716.88
8.1.00.0170.00017.11
8.0.280.0120.00416.52
8.0.270.0080.00816.63
8.0.260.0120.00416.52
8.0.250.0140.00216.52
8.0.240.0120.00416.52
8.0.230.0170.00016.52
8.0.220.0120.00316.52
8.0.210.0140.00316.52
8.0.200.0120.00616.52
8.0.190.0110.00516.63
8.0.180.0170.00016.52
8.0.170.0120.00416.63
8.0.160.0090.00616.75
8.0.150.0120.00416.52
8.0.140.0080.00816.61
8.0.130.0110.00416.63
8.0.120.0150.00016.52
8.0.110.0070.00716.52
8.0.100.0130.00316.52
8.0.90.0080.00816.52
8.0.80.0100.00516.52
8.0.70.0100.00716.61
8.0.60.0130.00416.52
8.0.50.0050.01016.52
8.0.30.0160.00016.63
8.0.20.0090.00916.52
8.0.10.0120.00416.62

preferences:
141.16 ms | 1005 KiB | 7 Q