3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html_string = '<!DOCTYPE html> <html> <body> <div id="foo"> This is a paragraph with <strong>Some nested tags</strong> </div> <div class="test" id="bar"> <div> And a nested div? </div> </div> <div class="baz test"> <p> Pretty normal HTML. </p> </div> </body> </html>'; $regex = '/<div[^>]*?(class="(.+?)"[^>]*)?>((?:.*?(?:(?!<div)|(?R))*)*)' . '<\/div>/sm'; if (preg_match_all($regex, $html_string, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { if (in_array('test', explode(' ', $match[2]))) { echo trim ($match[4]); } } }

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.0060.01117.00
8.3.50.0100.00722.17
8.3.40.0110.00418.84
8.3.30.0000.01519.13
8.3.20.0080.00020.34
8.3.10.0060.00323.71
8.3.00.0080.00019.79
8.2.180.0140.00418.66
8.2.170.0100.00622.96
8.2.160.0150.00420.43
8.2.150.0050.00324.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0040.00421.21
8.2.110.0000.01022.42
8.2.100.0070.00418.28
8.2.90.0050.00319.34
8.2.80.0060.00317.97
8.2.70.0060.00317.88
8.2.60.0060.00318.03
8.2.50.0050.00518.07
8.2.40.0000.00818.28
8.2.30.0000.00718.34
8.2.20.0050.00317.79
8.2.10.0040.00418.10
8.2.00.0040.00418.00
8.1.280.0070.00725.92
8.1.270.0030.00623.95
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0080.00424.09
8.1.230.0040.00719.03
8.1.220.0060.00317.76
8.1.210.0050.00518.77
8.1.200.0100.00017.48
8.1.190.0000.00817.36
8.1.180.0080.00018.10
8.1.170.0000.00918.78
8.1.160.0040.00421.96
8.1.150.0070.00018.97
8.1.140.0030.00517.62
8.1.130.0030.00617.85
8.1.120.0000.00717.54
8.1.110.0000.00917.59
8.1.100.0000.00817.63
8.1.90.0040.00417.53
8.1.80.0080.00017.68
8.1.70.0030.00317.56
8.1.60.0000.00917.72
8.1.50.0040.00417.65
8.1.40.0000.00817.61
8.1.30.0040.00417.86
8.1.20.0030.00617.82
8.1.10.0000.00817.75
8.1.00.0000.00817.69
8.0.300.0040.00418.77
8.0.290.0050.00317.00
8.0.280.0030.00518.47
8.0.270.0000.00817.31
8.0.260.0000.00717.28
8.0.250.0000.00717.04
8.0.240.0000.00717.06
8.0.230.0070.00017.08
8.0.220.0000.00717.13
8.0.210.0000.00717.01
8.0.200.0040.00417.20
8.0.190.0060.00317.19
8.0.180.0000.00717.02
8.0.170.0040.00417.12
8.0.160.0040.00417.13
8.0.150.0050.00217.04
8.0.140.0050.00217.08
8.0.130.0060.00013.59
8.0.120.0050.00317.14
8.0.110.0040.00417.15
8.0.100.0030.00517.02
8.0.90.0000.00716.95
8.0.80.0090.00617.12
8.0.70.0000.00716.99
8.0.60.0070.00017.13
8.0.50.0050.00317.14
8.0.30.0130.01117.16
8.0.20.0120.00717.42
8.0.10.0050.00217.14
8.0.00.0080.01016.88
7.4.330.0050.00015.13
7.4.320.0000.00616.73
7.4.300.0060.00016.75
7.4.290.0040.00416.81
7.4.280.0000.00816.84
7.4.270.0030.00316.75
7.4.260.0070.00016.62
7.4.250.0040.00416.72
7.4.240.0040.00416.77
7.4.230.0020.00516.63
7.4.220.0140.00416.88
7.4.210.0100.00316.81
7.4.200.0000.00716.49
7.4.160.0070.01016.59
7.4.150.0070.01617.40
7.4.140.0070.01117.86
7.4.130.0100.00816.82
7.4.120.0090.01116.66
7.4.110.0130.01016.61
7.4.100.0090.00916.79
7.4.90.0080.00816.75
7.4.80.0130.00619.39
7.4.70.0110.00716.68
7.4.60.0060.00916.64
7.4.50.0000.00916.43
7.4.40.0100.01016.63
7.4.30.0130.00316.90
7.4.10.0060.01215.21
7.4.00.0080.00715.27
7.3.330.0030.00313.48
7.3.320.0030.00313.29
7.3.310.0000.00716.56
7.3.300.0070.00016.59
7.3.290.0170.00616.46
7.3.280.0050.01616.48
7.3.270.0100.00717.40
7.3.260.0150.00416.90
7.3.250.0100.01116.76
7.3.240.0090.01016.86
7.3.230.0070.01116.79
7.3.210.0070.01016.81
7.3.200.0130.00319.39
7.3.190.0100.00616.50
7.3.180.0130.00316.51
7.3.170.0080.01216.58
7.3.160.0080.00816.76
7.3.130.0090.00315.11
7.3.120.0050.01314.98
7.3.110.0060.01115.03
7.3.100.0050.01014.98
7.3.90.0030.01014.89
7.3.80.0040.00615.11
7.3.70.0070.00915.00
7.3.60.0060.00815.20
7.3.50.0080.00514.99
7.3.40.0050.00615.15
7.3.30.0070.00615.18
7.3.20.0060.00616.93
7.3.10.0070.00716.71
7.3.00.0060.00916.72
7.2.330.0110.00716.88
7.2.320.0040.01416.86
7.2.310.0170.00016.75
7.2.300.0080.00817.00
7.2.290.0070.01516.84
7.2.260.0040.01215.30
7.2.250.0100.00815.36
7.2.240.0050.01115.16
7.2.230.0070.01015.28
7.2.220.0080.00815.28
7.2.210.0060.00915.24
7.2.200.0030.01015.51
7.2.190.0040.01115.10
7.2.180.0060.00615.12
7.2.170.0060.00815.20
7.2.160.0040.01015.46
7.2.150.0050.00716.92
7.2.140.0070.00917.01
7.2.130.0060.01016.96
7.2.120.0050.00817.00
7.2.110.0050.00916.97
7.2.100.0060.00916.82
7.2.90.0090.00816.96
7.2.80.0060.01017.05
7.2.70.0040.01017.15
7.2.60.0110.00717.03
7.2.50.0090.01117.05
7.2.40.0060.00816.94
7.2.30.0090.01016.95
7.2.20.0090.00716.90
7.2.10.0110.00816.99
7.2.00.0090.00917.57
7.1.330.0070.01016.12
7.1.320.0060.00816.12
7.1.310.0070.00716.27
7.1.300.0040.00615.97
7.1.290.0030.01116.06
7.1.280.0040.01116.06
7.1.270.0050.00716.01
7.1.260.0090.00615.89
7.1.250.0070.00615.81
7.1.240.0050.00715.87
7.1.230.0000.01515.98
7.1.220.0050.00816.03
7.1.210.0040.00916.12
7.1.200.0040.00916.19
7.1.190.0050.01016.07
7.1.180.0060.00516.04
7.1.170.0010.00816.06
7.1.160.0080.00516.04
7.1.150.0080.00816.06
7.1.140.0070.00916.19
7.1.130.0100.00715.91
7.1.120.0080.00515.96
7.1.110.0080.00616.00
7.1.100.0060.00816.82
7.1.90.0080.00816.09
7.1.80.0110.00516.01
7.1.70.0060.01116.50
7.1.60.0040.01017.16
7.1.50.0070.01116.52
7.1.40.0080.00715.97
7.1.30.0050.00815.95
7.1.20.0080.00115.89
7.1.10.0050.01016.06
7.1.00.0060.02818.16
7.0.330.0060.00515.49
7.0.320.0060.00615.58
7.0.310.0040.01115.41
7.0.300.0080.00615.55
7.0.290.0080.00515.50
7.0.280.0020.00615.57
7.0.270.0050.00915.67
7.0.260.0040.00815.58
7.0.250.0070.00715.65
7.0.240.0050.00915.55
7.0.230.0070.00515.57
7.0.220.0050.01015.54
7.0.210.0090.00315.73
7.0.200.0040.00816.12
7.0.190.0090.00415.65
7.0.180.0060.00615.70
7.0.170.0020.01115.31
7.0.160.0060.00715.57
7.0.150.0080.00615.68
7.0.140.0100.02617.82
7.0.130.0070.00515.64
7.0.120.0030.00915.58
7.0.110.0080.00315.74
7.0.100.0000.01115.65
7.0.90.0070.00815.55
7.0.80.0080.00515.56
7.0.70.0070.00815.57
7.0.60.0100.03117.03
7.0.50.0060.02316.54
7.0.40.0090.01815.86
7.0.30.0200.03015.59
7.0.20.0120.01515.86
7.0.10.0030.02115.91
7.0.00.0090.02715.83
5.6.400.0070.01114.76
5.6.390.0070.00514.93
5.6.380.0030.00914.68
5.6.370.0090.00714.60
5.6.360.0030.01014.49
5.6.350.0030.00914.47
5.6.340.0050.00514.84
5.6.330.0030.01014.48
5.6.320.0040.00814.61
5.6.310.0070.00514.63
5.6.300.0060.00714.53
5.6.290.0100.00614.75
5.6.280.0060.02816.75
5.6.270.0050.00614.72
5.6.260.0070.00514.85
5.6.250.0050.00814.75
5.6.240.0110.00514.71
5.6.230.0060.00714.77
5.6.220.0050.00514.60
5.6.210.0070.03316.57
5.6.200.0090.02115.88
5.6.190.0060.03416.79
5.6.180.0110.01816.55
5.6.170.0160.03216.66
5.6.160.0030.02116.56
5.6.150.0040.02415.83
5.6.140.0050.03315.89
5.6.130.0060.03215.83
5.6.120.0060.03216.67
5.6.110.0050.03116.63
5.6.100.0040.03416.83
5.6.90.0050.03316.79
5.6.80.0070.03216.60
5.6.70.0050.00914.64
5.6.60.0040.01114.57
5.6.50.0060.00814.64
5.6.40.0090.00714.33
5.6.30.0100.00514.57
5.6.20.0040.00614.63
5.6.10.0060.00514.71
5.6.00.0050.00414.56
5.5.380.0070.00414.60
5.5.370.0080.00714.44
5.5.360.0080.00414.68
5.5.350.0040.02016.71
5.5.340.0080.01915.72
5.5.330.0060.03116.55
5.5.320.0150.02916.42
5.5.310.0120.02816.45
5.5.300.0090.02815.84
5.5.290.0050.03415.79
5.5.280.0070.02516.75
5.5.270.0100.01916.81
5.5.260.0040.02116.74
5.5.250.0080.01916.54
5.5.240.1110.01816.54
5.5.230.0070.00414.27
5.5.220.0040.00814.65
5.5.210.0080.00514.41
5.5.200.0060.01114.56
5.5.190.0040.01214.66
5.5.180.0030.00914.50
5.5.170.0050.00814.43
5.5.160.0060.00814.46
5.5.150.0040.00914.32
5.5.140.0030.01014.30
5.5.130.0030.00614.62
5.5.120.0090.00514.51
5.5.110.0090.00514.44
5.5.100.0030.00814.68
5.5.90.0020.00814.49
5.5.80.0020.01714.50
5.5.70.0030.01014.44
5.5.60.0060.00914.40
5.5.50.0080.00514.41
5.5.40.0050.00914.47
5.5.30.0070.00814.55
5.5.20.0080.00414.35
5.5.10.0070.00814.43
5.5.00.0070.00814.40
5.4.450.0090.02114.73
5.4.440.0100.02314.72
5.4.430.0190.01814.65
5.4.420.0180.02114.68
5.4.410.0120.01614.64
5.4.400.0220.01914.58
5.4.390.0090.02114.62
5.4.380.0120.02214.36
5.4.370.0090.01814.39
5.4.360.0120.01914.41
5.4.350.0070.02214.36
5.4.340.0060.02214.36
5.4.330.0080.00012.23
5.4.320.0040.01812.35
5.4.310.0010.01812.35
5.4.300.0070.01612.35
5.4.290.0050.01812.35
5.4.280.0040.02112.31
5.4.270.0050.01612.31
5.4.260.0070.01412.31
5.4.250.0050.01712.32
5.4.240.0060.01612.32
5.4.230.0070.01512.31
5.4.220.0050.01612.31
5.4.210.0060.01612.31
5.4.200.0050.01512.31
5.4.190.0070.02112.31
5.4.180.0030.01912.31
5.4.170.0060.01612.31
5.4.160.0020.01812.31
5.4.150.0060.02012.31
5.4.140.0060.01612.21
5.4.130.0060.01712.20
5.4.120.0060.01712.22
5.4.110.0020.01912.22
5.4.100.0050.02012.22
5.4.90.0060.01712.22
5.4.80.0060.01612.22
5.4.70.0070.01412.22
5.4.60.0030.02212.22
5.4.50.0050.01812.22
5.4.40.0070.01712.22
5.4.30.0030.01712.22
5.4.20.0060.01512.22
5.4.10.0040.01712.22
5.4.00.0060.01612.02
5.3.290.0050.01812.44
5.3.280.0060.01712.42
5.3.270.0060.02312.42
5.3.260.0050.02012.42
5.3.250.0070.01512.42
5.3.240.0050.01812.42
5.3.230.0060.01912.42
5.3.220.0050.01812.44
5.3.210.0050.01712.44
5.3.200.0050.01712.44
5.3.190.0060.01412.44
5.3.180.0030.01912.44
5.3.170.0030.01912.44
5.3.160.0060.01612.44
5.3.150.0040.01612.44
5.3.140.0060.01712.44
5.3.130.0050.01612.44
5.3.120.0040.01712.44
5.3.110.0040.01912.44
5.3.100.0060.01812.27
5.3.90.0050.01512.23
5.3.80.0020.01812.23
5.3.70.0050.01712.23
5.3.60.0050.01612.23
5.3.50.0040.01612.21
5.3.40.0070.01312.21
5.3.30.0030.01712.19
5.3.20.0070.01312.12
5.3.10.0040.01912.11
5.3.00.0030.01812.10
5.2.170.0070.0279.36
5.2.160.0070.0279.36
5.2.150.0030.0319.36
5.2.140.0070.0339.36
5.2.130.0060.0299.32
5.2.120.0060.0279.32
5.2.110.0040.0379.32
5.2.100.0080.0289.32
5.2.90.0070.0269.31
5.2.80.0030.0319.31
5.2.70.0050.0319.31
5.2.60.0060.0359.26
5.2.50.0050.0299.23
5.2.40.0030.0309.19
5.2.30.0020.0409.16
5.2.20.0040.0299.15
5.2.10.0040.0298.99
5.2.00.0050.0328.85
5.1.60.0050.0248.17
5.1.50.0020.0268.17
5.1.40.0050.0328.15
5.1.30.0030.0278.50
5.1.20.0050.0258.52
5.1.10.0040.0288.25
5.1.00.0050.0278.25
5.0.50.0050.0196.73
5.0.40.0040.0206.57
5.0.30.0030.0316.39
5.0.20.0040.0256.36
5.0.10.0030.0196.33
5.0.00.0010.0326.33
4.4.90.0020.0154.82
4.4.80.0030.0144.76
4.4.70.0040.0154.76
4.4.60.0030.0174.77
4.4.50.0030.0154.77
4.4.40.0040.0284.72
4.4.30.0020.0214.76
4.4.20.0010.0174.85
4.4.10.0030.0154.85
4.4.00.0050.0304.76
4.3.110.0010.0174.67
4.3.100.0040.0144.66
4.3.90.0050.0124.63
4.3.80.0040.0234.63
4.3.70.0020.0154.63
4.3.60.0030.0144.63
4.3.50.0020.0194.62
4.3.40.0010.0254.59
4.3.30.0040.0173.39
4.3.20.0030.0143.36
4.3.10.0010.0163.32
4.3.00.0000.02014.48

preferences:
53.67 ms | 401 KiB | 5 Q