3v4l.org

run code in 300+ PHP versions simultaneously
<?php // test function: function parse($html) { // I have split the pattern in two lines not to have long lines alerts by the PHP.net form: $pattern = "/<([\w]+)([^>]*?)(([\s]*\/>)|". "(>((([^<]*?|<\!\-\-.*?\-\->)|(?R))*)<\/\\1[\s]*>))/sm"; preg_match_all($pattern, $html, $matches, PREG_OFFSET_CAPTURE); $elements = array(); foreach ($matches[0] as $key => $match) { $elements[] = (object)array( 'node' => $match[0], 'offset' => $match[1], 'tagname' => $matches[1][$key][0], 'attributes' => isset($matches[2][$key][0]) ? $matches[2][$key][0] : '', 'omittag' => ($matches[4][$key][1] > -1), // boolean 'inner_html' => isset($matches[6][$key][0]) ? $matches[6][$key][0] : '' ); } return $elements; } // random html nodes as example: $html = <<<EOD <div id="airport"> <div geo:position="1.234324,3.455546" class="index"> <!-- comment test: <div class="index_top" /> --> <div class="element decorator"> <ul class="lister"> <li onclick="javascript:item.showAttribute('desc');"> <h3 class="outline"> <a href="http://php.net/manual/en/regexp.reference.recursive.php" onclick="openPopup()">Link</a> </h3> <div class="description">Sample description</div> </li> </ul> </div> <div class="clean-line"></div> </div> </div> <div id="omittag_test" rel="rootChild" /> EOD; // application: $elements = parse($html); if (count($elements) > 0) { echo "Elements found: <b>".count($elements)."</b><br />"; foreach ($elements as $element) { echo "<p>Tpl node: <pre>".htmlentities($element->node)."</pre> Tagname: <tt>".$element->tagname."</tt><br /> Attributes: <tt>".$element->attributes."</tt><br /> Omittag: <tt>".($element->omittag ? 'true' : 'false')."</tt><br /> Inner HTML: <pre>".htmlentities($element->inner_html)."</pre></p>"; } } ?>

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.0090.00616.63
8.3.50.0120.00618.51
8.3.40.0100.00619.08
8.3.30.0110.00419.22
8.3.20.0040.00420.30
8.3.10.0090.00020.91
8.3.00.0050.00319.63
8.2.180.0040.01118.50
8.2.170.0070.01122.96
8.2.160.0070.00720.66
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0040.00421.04
8.2.110.0090.00022.19
8.2.100.0080.00418.28
8.2.90.0030.00519.33
8.2.80.0040.00418.00
8.2.70.0060.00317.86
8.2.60.0030.00618.29
8.2.50.0000.00918.07
8.2.40.0070.00318.28
8.2.30.0030.00519.65
8.2.20.0000.00817.93
8.2.10.0000.00818.32
8.2.00.0080.00017.93
8.1.270.0040.00422.15
8.1.260.0000.00826.35
8.1.250.0060.00328.09
8.1.240.0060.00324.04
8.1.230.0040.00819.13
8.1.220.0080.00017.89
8.1.210.0050.00318.77
8.1.200.0090.00017.50
8.1.190.0040.00417.48
8.1.180.0030.00518.10
8.1.170.0090.00418.59
8.1.160.0040.00422.14
8.1.150.0000.00719.06
8.1.140.0000.00717.67
8.1.130.0000.00718.01
8.1.120.0040.00417.77
8.1.110.0030.00617.69
8.1.100.0040.00417.59
8.1.90.0000.00717.65
8.1.80.0060.00317.74
8.1.70.0030.00317.69
8.1.60.0060.00317.85
8.1.50.0050.00317.75
8.1.40.0000.00817.77
8.1.30.0050.00317.95
8.1.20.0030.00517.90
8.1.10.0000.00817.84
8.1.00.0040.00417.65
8.0.300.0030.00619.21
8.0.290.0040.00417.13
8.0.280.0000.00718.60
8.0.270.0040.00417.38
8.0.260.0040.00417.38
8.0.250.0030.00317.14
8.0.240.0070.00017.28
8.0.230.0000.00717.21
8.0.220.0030.00517.22
8.0.210.0030.00317.07
8.0.200.0000.00817.09
8.0.190.0110.00017.16
8.0.180.0000.00817.25
8.0.170.0000.00917.13
8.0.160.0000.00717.06
8.0.150.0040.00417.16
8.0.140.0070.00017.06
8.0.130.0000.00913.56
8.0.120.0040.00417.20
8.0.110.0000.00717.08
8.0.100.0040.00417.09
8.0.90.0030.00517.27
8.0.80.0130.00317.18
8.0.70.0050.00317.27
8.0.60.0040.00417.20
8.0.50.0050.00217.00
8.0.30.0100.01017.41
8.0.20.0130.00817.56
8.0.10.0050.00217.22
8.0.00.0110.00717.19
7.4.330.0030.00315.02
7.4.320.0060.00316.88
7.4.300.0040.00416.83
7.4.290.0030.00316.71
7.4.280.0060.00316.86
7.4.270.0000.00816.88
7.4.260.0030.00316.67
7.4.250.0030.00516.90
7.4.240.0030.00416.75
7.4.230.0070.00016.71
7.4.220.0090.00916.93
7.4.210.0090.00617.01
7.4.200.0050.00216.99
7.4.160.0160.00416.95
7.4.150.0050.01317.40
7.4.140.0080.01017.86
7.4.130.0070.01116.79
7.4.120.0110.00716.83
7.4.110.0170.00016.66
7.4.100.0070.01116.79
7.4.90.0090.00916.75
7.4.80.0000.01619.39
7.4.70.0030.01316.82
7.4.60.0120.00616.97
7.4.50.0000.00816.87
7.4.40.0160.00016.77
7.4.30.0060.01016.84
7.4.10.0030.01215.25
7.4.00.0090.00815.16
7.3.330.0030.00313.63
7.3.320.0030.00313.67
7.3.310.0000.00716.49
7.3.300.0030.00316.70
7.3.290.0090.00616.72
7.3.280.0110.00716.65
7.3.270.0060.01517.40
7.3.260.0100.00716.83
7.3.250.0130.01116.69
7.3.240.0060.01516.76
7.3.230.0350.00916.92
7.3.210.0090.00916.61
7.3.200.0060.01019.39
7.3.190.0100.01216.84
7.3.180.0070.01416.64
7.3.170.0100.00716.79
7.3.160.0030.01716.79
7.3.130.0100.01015.27
7.3.120.0030.01415.17
7.3.110.0070.01015.11
7.3.100.0090.00415.19
7.3.90.0110.00415.28
7.3.80.0030.00614.81
7.3.70.0040.01115.10
7.3.60.0030.01215.15
7.3.50.0070.01115.13
7.3.40.0060.00314.90
7.3.30.0060.01215.05
7.3.20.0100.00717.04
7.3.10.0060.00816.85
7.3.00.0130.00416.69
7.2.330.0040.01516.77
7.2.320.0100.01016.99
7.2.310.0070.01616.87
7.2.300.0120.00616.81
7.2.290.0090.00916.90
7.2.260.0030.01615.33
7.2.250.0140.00715.32
7.2.240.0030.01415.48
7.2.230.0040.01115.61
7.2.220.0070.01315.36
7.2.210.0030.01115.02
7.2.200.0030.00615.54
7.2.190.0030.01215.09
7.2.180.0030.01015.52
7.2.170.0000.01515.60
7.2.160.0030.00915.30
7.2.150.0100.00717.05
7.2.140.0040.00817.13
7.2.130.0110.00717.08
7.2.120.0020.01117.04
7.2.110.0110.00416.93
7.2.100.0030.01016.90
7.2.90.0040.01016.79
7.2.80.0090.00717.11
7.2.70.0060.00617.16
7.2.60.0110.00417.12
7.2.50.0040.01516.85
7.2.40.0080.01517.15
7.2.30.0160.00817.12
7.2.20.0110.00516.90
7.2.10.0080.00917.21
7.2.00.0080.00817.96
7.1.330.0150.00016.08
7.1.320.0030.01316.11
7.1.310.0040.01116.13
7.1.300.0030.01216.08
7.1.290.0070.00716.04
7.1.280.0030.00916.00
7.1.270.0060.00316.18
7.1.260.0070.00316.20
7.1.250.0020.01116.03
7.1.240.0000.01116.16
7.1.230.0000.01415.86
7.1.220.0030.01016.00
7.1.210.0040.00715.96
7.1.200.0060.00516.15
7.1.190.0070.00316.09
7.1.180.0100.00316.00
7.1.170.0100.00716.18
7.1.160.0030.00615.90
7.1.150.0060.00915.79
7.1.140.0090.00616.24
7.1.130.0110.00316.05
7.1.120.0060.00615.96
7.1.110.0040.00815.82
7.1.100.0060.00817.18
7.1.90.0030.00615.98
7.1.80.0000.01116.07
7.1.70.0030.00816.79
7.1.60.0090.00717.71
7.1.50.0080.01016.55
7.1.40.0140.00316.14
7.1.30.0100.00316.03
7.1.20.0000.00915.76
7.1.10.0040.01116.09
7.1.00.0070.04219.32
7.0.330.0100.00615.91
7.0.320.0040.00415.66
7.0.310.0070.00715.37
7.0.300.0000.01315.73
7.0.290.0000.01015.58
7.0.280.0030.01215.57
7.0.270.0120.00315.21
7.0.260.0080.00415.48
7.0.250.0070.00715.76
7.0.240.0060.00615.71
7.0.230.0030.00715.75
7.0.220.0030.01015.70
7.0.210.0030.00915.70
7.0.200.0180.01215.42
7.0.190.0060.00915.64
7.0.180.0040.01215.56
7.0.170.0070.01015.32
7.0.160.0030.00915.44
7.0.150.0040.00715.65
7.0.140.0050.03818.83
7.0.130.0090.00315.65
7.0.120.0030.00715.58
7.0.110.0030.01015.83
7.0.100.0030.00615.66
7.0.90.0000.00815.52
7.0.80.0030.01015.75
7.0.70.0140.00015.89
7.0.60.0100.03817.83
7.0.50.0080.02916.83
7.0.40.0100.04217.00
7.0.30.0150.02916.97
7.0.20.0070.03016.97
7.0.10.0160.03817.04
7.0.00.0060.02417.00
5.6.400.0030.01215.12
5.6.390.0090.00615.14
5.6.380.0000.01414.79
5.6.370.0100.00314.83
5.6.360.0070.01014.82
5.6.350.0070.01015.18
5.6.340.0060.00914.85
5.6.330.0070.00714.81
5.6.320.0090.00315.13
5.6.310.0060.00614.99
5.6.300.0090.00014.89
5.6.290.0030.01014.65
5.6.280.0050.04017.94
5.6.270.0080.00414.72
5.6.260.0130.00014.91
5.6.250.0030.00714.87
5.6.240.0030.01014.92
5.6.230.0070.00714.82
5.6.220.0030.00914.82
5.6.210.0080.03617.84
5.6.200.0080.03016.73
5.6.190.0030.05117.87
5.6.180.0240.02617.79
5.6.170.0170.02717.87
5.6.160.0070.03017.80
5.6.150.0030.03016.52
5.6.140.0050.04716.83
5.6.130.0040.03416.56
5.6.120.0100.02518.09
5.6.110.0070.04518.10
5.6.100.0090.04018.01
5.6.90.0100.02818.09
5.6.80.0110.03117.81
5.6.70.0040.00715.02
5.6.60.0060.00614.90
5.6.50.0030.00714.97
5.6.40.0030.01414.71
5.6.30.0080.00414.78
5.6.20.0060.00914.73
5.6.10.0030.01014.89
5.6.00.0120.00014.86
5.5.380.0060.00614.89
5.5.370.0000.00914.84
5.5.360.0040.00414.92
5.5.350.0100.04517.75
5.5.340.0080.02516.62
5.5.330.0070.04717.86
5.5.320.0170.02717.57
5.5.310.0120.02317.72
5.5.300.0140.01916.66
5.5.290.0130.03616.60
5.5.280.0130.04118.12
5.5.270.0050.02517.83
5.5.260.0160.03818.05
5.5.250.0100.04017.80
5.5.240.0080.01917.51
5.5.230.0060.00914.72
5.5.220.0070.00314.62
5.5.210.0000.01214.74
5.5.200.0030.01014.78
5.5.190.0000.01114.91
5.5.180.0030.01014.94
5.5.170.0100.00714.66
5.5.160.0070.00714.87
5.5.150.0070.00414.92
5.5.140.0040.00814.66
5.5.130.0060.00614.63
5.5.120.0040.01114.90
5.5.110.0100.00714.66
5.5.100.0060.00914.77
5.5.90.0070.00714.78
5.5.80.0070.00714.91
5.5.70.0070.01014.63
5.5.60.0000.00914.96
5.5.50.0040.01114.68
5.5.40.0040.00414.40
5.5.30.0080.00414.96
5.5.20.0070.01014.57
5.5.10.0000.01214.70
5.5.00.0130.00314.86
5.4.450.0110.03115.62
5.4.440.0150.02415.82
5.4.430.0270.02015.60
5.4.420.0280.02715.88
5.4.410.0140.02315.47
5.4.400.0070.02715.37
5.4.390.0100.02615.60
5.4.380.0080.03715.21
5.4.370.0210.03215.37
5.4.360.0100.03614.96
5.4.350.0180.03415.19
5.4.340.0150.02714.98
5.4.330.0030.00611.58
5.4.320.0040.02312.05
5.4.310.0040.02312.03
5.4.300.0080.02012.22
5.4.290.0050.02112.19
5.4.280.0050.02212.09
5.4.270.0050.02612.02
5.4.260.0050.02212.09
5.4.250.0080.02712.21
5.4.240.0060.02712.24
5.4.230.0020.02312.02
5.4.220.0080.02012.29
5.4.210.0060.02012.14
5.4.200.0070.02212.01
5.4.190.0060.02212.13
5.4.180.0060.01911.99
5.4.170.0060.02012.22
5.4.160.0070.01912.15
5.4.150.0020.02611.93
5.4.140.0050.02411.97
5.4.130.0060.01912.01
5.4.120.0060.02412.05
5.4.110.0060.02212.02
5.4.100.0090.01912.10
5.4.90.0090.01812.14
5.4.80.0070.02412.04
5.4.70.0020.02312.12
5.4.60.0020.02212.11
5.4.50.0080.01811.94
5.4.40.0070.02012.06
5.4.30.0060.02211.97
5.4.20.0060.02312.06
5.4.10.0080.01812.06
5.4.00.0040.02011.76
5.3.290.0030.04513.06
5.3.280.0070.04612.98
5.3.270.0090.03612.99
5.3.260.0070.04713.00
5.3.250.0050.04213.00
5.3.240.0070.03713.00
5.3.230.0100.03612.99
5.3.220.0070.03813.14
5.3.210.0070.04013.14
5.3.200.0050.03713.14
5.3.190.0040.04013.14
5.3.180.0070.03513.16
5.3.170.0080.03913.16
5.3.160.0080.03713.16
5.3.150.0070.03613.16
5.3.140.0050.03713.15
5.3.130.0080.03713.14
5.3.120.0040.04113.15
5.3.110.0080.03713.15
5.3.100.0090.03512.63
5.3.90.0080.03712.48
5.3.80.0060.03712.47
5.3.70.0040.03912.46
5.3.60.0090.04612.45
5.3.50.0050.03812.41
5.3.40.0030.04012.41
5.3.30.0050.04112.36
5.3.20.0070.03412.14
5.3.10.0060.03512.09
5.3.00.0060.03812.08
5.2.170.0050.0319.58
5.2.160.0090.0359.59
5.2.150.0040.0329.59
5.2.140.0040.0319.58
5.2.130.0040.0309.54
5.2.120.0080.0369.54
5.2.110.0030.0329.54
5.2.100.0070.0279.54
5.2.90.0030.0319.53
5.2.80.0070.0299.52
5.2.70.0050.0309.53
5.2.60.0060.0309.48
5.2.50.0070.0289.45
5.2.40.0040.0309.43
5.2.30.0030.0339.39
5.2.20.0030.0319.41
5.2.10.0070.0279.29
5.2.00.0070.0279.16
5.1.60.0030.0288.45
5.1.50.0020.0278.44
5.1.40.0060.0268.42
5.1.30.0040.0278.77
5.1.20.0060.0279.03
5.1.10.0050.0258.75
5.1.00.0040.0268.75
5.0.50.0040.0207.24
5.0.40.0020.0247.03
5.0.30.0030.0336.84
5.0.20.0050.0196.81
5.0.10.0090.0156.78
5.0.00.0040.0316.78
4.4.90.0060.0205.05
4.4.80.0060.0125.02
4.4.70.0040.0225.02
4.4.60.0040.0195.02
4.4.50.0030.0185.02
4.4.40.0060.0325.01
4.4.30.0040.0155.01
4.4.20.0050.0145.30
4.4.10.0050.0145.30
4.4.00.0040.0245.27
4.3.110.0050.0145.11
4.3.100.0040.0205.09
4.3.90.0040.0195.08
4.3.80.0030.0245.07
4.3.70.0040.0145.07
4.3.60.0040.0145.07
4.3.50.0010.0185.07
4.3.40.0000.0315.02
4.3.30.0020.0213.84
4.3.20.0030.0163.32
4.3.10.0020.0153.28
4.3.00.0100.01713.95

preferences:
48.03 ms | 400 KiB | 5 Q