3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = "Made in Switzerland, this stainless steel watch has single and double wrap interchangeable leather straps and is water resistant up to 30 meters<br><p><br></p>"; // $html = "<p>some thing</p>shitty p stuff<p>correct</p>\r\n<p>what about this</p>this is not correct\n"; // $html = "<p>some thing</p><p>shitty p stuff</p><p>correct</p><p>what about this</p>this is not correct"; // $html = "<p><a href=\"http://www.beataheuman.com/shop/\" title=\"www.beataheuman.com\">www.beataheuman.com</a>.</p><br />"; // $html = "ptest"; var_dump($html); // add <p></p> to the text if missing var_dump($html); // fix not closed paragraphs // $html = preg_replace('~(<p>.*?)([^</p>]<p>)~', '$1</p><p>', $html); var_dump($html); $html = preg_replace('~(\r\n|\n|\r)~s', '', $html); var_dump($html); // add into p the text in between paragraphs $html = preg_replace('~</p>([^<p>].+?)<p>~', '</p><p>$1</p><p>', $html); var_dump($html); // add into p the text after the last paragraph $html = preg_replace('~</p>((?!<p>).+)?$~Ds', '</p><p>$1</p>', $html, 1); var_dump($html); $html = preg_replace('~<p>(\W*)</p>~', '', $html); // $html = preg_replace('~^(<p>)?((?!</p>).*)(</p>)?$~A', '<p>$2</p>', $html); // if ($pPos = strpos($html, '<p>')) { // $html = '<p>' . substr($html, . '</p>'; // } // fix &nbsp; $html = html_entity_decode($html, null, 'UTF-8'); // change & to &amp; $html = preg_replace('/&(?!#?[a-z0-9]+;)/', '&amp;', $html); $paragraphPosition = strpos($html, '<p>'); if (0 !== $paragraphPosition) { $html = '<p>' . substr($html, 0, $paragraphPosition) . '</p>' . substr($html, $paragraphPosition); } var_dump($html);

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.3.60.0080.00817.00
8.3.50.0040.01118.25
8.3.40.0100.00619.14
8.3.30.0130.01018.93
8.3.20.0000.00818.74
8.3.10.0040.00421.82
8.3.00.0090.00021.57
8.2.180.0070.01416.75
8.2.170.0040.01122.96
8.2.160.0120.00622.15
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00419.68
8.2.120.0040.00426.35
8.2.110.0080.00320.55
8.2.100.0120.00017.97
8.2.90.0040.00417.88
8.2.80.0040.00417.97
8.2.70.0030.00618.05
8.2.60.0000.00818.03
8.2.50.0080.00018.10
8.2.40.0060.00319.44
8.2.30.0000.00719.29
8.2.20.0070.00018.02
8.2.10.0000.00718.23
8.2.00.0040.00417.87
8.1.280.0120.00325.92
8.1.270.0030.00523.78
8.1.260.0000.00828.09
8.1.250.0000.00828.09
8.1.240.0030.00622.47
8.1.230.0070.00419.21
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.47
8.1.190.0050.00517.47
8.1.180.0050.00318.10
8.1.170.0040.00418.60
8.1.160.0040.00423.91
8.1.150.0110.00019.02
8.1.140.0040.00419.55
8.1.130.0050.00217.66
8.1.120.0080.00317.61
8.1.110.0040.00417.54
8.1.100.0040.00417.53
8.1.90.0000.00717.60
8.1.80.0030.00517.62
8.1.70.0050.00317.53
8.1.60.0000.00817.73
8.1.50.0040.00417.58
8.1.40.0030.00617.52
8.1.30.0040.00417.67
8.1.20.0040.00417.88
8.1.10.0040.00417.67
8.1.00.0000.00817.49
8.0.300.0050.00219.89
8.0.290.0000.00917.00
8.0.280.0030.00318.49
8.0.270.0080.00017.31
8.0.260.0030.00317.29
8.0.250.0000.00717.13
8.0.240.0000.00817.09
8.0.230.0070.00017.11
8.0.220.0000.00717.05
8.0.210.0000.00716.96
8.0.200.0000.00717.12
8.0.190.0080.00017.14
8.0.180.0000.00716.97
8.0.170.0070.00017.12
8.0.160.0070.00016.91
8.0.150.0040.00417.00
8.0.140.0040.00417.02
8.0.130.0000.00613.48
8.0.120.0060.00317.02
8.0.110.0000.00817.00
8.0.100.0000.00817.02
8.0.90.0000.00816.86
8.0.80.0070.01317.11
8.0.70.0040.00417.08
8.0.60.0050.00317.09
8.0.50.0040.00417.05
8.0.30.0090.00817.21
8.0.20.0110.01017.40
8.0.10.0040.00416.95
8.0.00.0090.00916.74
7.4.330.0030.00315.55
7.4.320.0060.00016.64
7.4.300.0060.00016.71
7.4.290.0040.00416.81
7.4.280.0020.00516.59
7.4.270.0080.00016.75
7.4.260.0020.00516.63
7.4.250.0080.00016.69
7.4.240.0090.00016.79
7.4.230.0000.00716.84
7.4.220.0100.01016.94
7.4.210.0000.01416.87
7.4.200.0030.00516.93
7.4.160.0070.00916.81
7.4.150.0130.00617.40
7.4.140.0100.01017.86
7.4.130.0070.01316.70
7.4.120.0090.00916.71
7.4.110.0100.01516.65
7.4.100.0050.01516.56
7.4.90.0040.01416.60
7.4.80.0120.00819.39
7.4.70.0100.00716.62
7.4.60.0030.02016.95
7.4.50.0090.00916.68
7.4.40.0040.01416.79
7.4.30.0100.00816.75
7.4.00.0060.00615.04
7.3.330.0000.00613.18
7.3.320.0060.00013.29
7.3.310.0070.00016.38
7.3.300.0050.00316.27
7.3.290.0110.00716.45
7.3.280.0090.00816.42
7.3.270.0120.00617.40
7.3.260.0070.01116.50
7.3.250.0120.00716.72
7.3.240.0090.01016.70
7.3.230.0160.00616.46
7.3.210.0060.01216.47
7.3.200.0090.01019.39
7.3.190.0130.00316.90
7.3.180.0150.00416.55
7.3.170.0110.00616.63
7.3.160.0170.00016.61
7.2.330.0090.01116.77
7.2.320.0120.00616.94
7.2.310.0110.00716.75
7.2.300.0150.00916.83
7.2.290.0150.00316.68
7.2.60.0080.00817.06
7.2.00.0070.00719.58
7.1.200.0070.00315.85
7.1.70.0000.00817.31
7.1.60.0040.00717.50
7.1.00.0030.07722.45
7.0.200.0100.00715.16
7.0.120.0100.05022.03
7.0.110.0030.06322.11
7.0.100.0000.06322.03
7.0.90.0070.05722.11
7.0.80.0000.06322.10
7.0.70.0130.06322.05
7.0.60.0230.06722.02
7.0.50.0270.05021.99
7.0.40.0030.08322.11
7.0.30.0100.05322.03
7.0.20.0130.05321.98
7.0.10.0000.06322.14
7.0.00.0200.05322.05
5.6.270.0030.06321.09
5.6.260.0030.06720.88
5.6.250.0030.05721.10
5.6.240.0200.04720.76
5.6.230.0100.07020.88
5.6.220.0070.05721.05
5.6.210.0130.07020.95
5.6.200.0170.08020.76
5.6.190.0130.05720.87
5.6.180.0070.05721.04
5.6.170.0170.06721.06
5.6.160.0100.05720.84
5.6.150.0070.07320.93
5.6.140.0100.05320.83
5.6.130.0130.05020.92
5.6.120.0130.05320.79
5.6.110.0070.06020.92
5.6.100.0070.05720.73
5.6.90.0070.05321.07
5.6.80.0070.05020.21
5.6.70.0070.05020.30
5.6.60.0000.06020.31
5.6.50.0070.05020.38
5.6.40.0030.05720.20
5.6.30.0070.05320.40
5.6.20.0070.05720.39
5.6.10.0030.05320.38
5.6.00.0070.05320.29

preferences:
58.91 ms | 400 KiB | 5 Q