3v4l.org

run code in 300+ PHP versions simultaneously
<?php $htmlData = '<h1><span> test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span> <span> test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span> <span> test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span> <span> test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span> </h1> '; echo $htmlData = preg_replace_callback('/<li(.*?)>(.*?)<\/li>(.*?)/s', 'replaceRule19Matches', $htmlData); function replaceRule19Matches($matches) { $outString = ''; $matchList = []; preg_match_all('/<span[^>]*>(.*?)<\/span>/s', $matches[0], $matchList); foreach ($matchList[0] as $match) { $htmlToMatch = htmlentities($match); if ((substr_count($htmlToMatch, "&amp;nbsp;") == 5) && (str_word_count($htmlToMatch) == 5)) { $outString = str_replace($match, '<b style="width:14px; display: inline-block;">&nbsp;</b>', $matches[0]); } else if (substr_count($htmlToMatch, "&amp;nbsp;") == 20) { $outString = str_replace($match, '<b style="width:35px; display: inline-block;">&nbsp;</b>', $matches[0]); } } return $outString == '' ? $matches[0] : $outString; }

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.01216.88
8.3.50.0090.00618.30
8.3.40.0130.00318.96
8.3.30.0110.00318.96
8.3.20.0000.00720.51
8.3.10.0060.00323.64
8.3.00.0040.00419.38
8.2.180.0090.00618.54
8.2.170.0070.01022.96
8.2.160.0100.00719.41
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0050.00317.46
8.2.120.0060.00326.35
8.2.110.0100.00021.02
8.2.100.0120.00018.03
8.2.90.0000.00817.88
8.2.80.0080.00018.91
8.2.70.0030.00517.75
8.2.60.0050.00317.75
8.2.50.0000.01018.07
8.2.40.0000.00719.32
8.2.30.0000.00720.67
8.2.20.0000.01017.86
8.2.10.0000.00718.04
8.2.00.0020.00518.02
8.1.280.0110.00425.92
8.1.270.0040.00824.01
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0070.00319.43
8.1.230.0060.00517.71
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0000.00917.36
8.1.190.0050.00317.48
8.1.180.0030.00618.10
8.1.170.0040.00418.95
8.1.160.0070.00021.90
8.1.150.0040.00418.83
8.1.140.0080.00019.46
8.1.130.0000.00717.69
8.1.120.0070.00017.57
8.1.110.0070.00017.62
8.1.100.0000.00817.63
8.1.90.0000.00717.60
8.1.80.0000.00717.45
8.1.70.0000.00717.43
8.1.60.0040.00417.69
8.1.50.0000.00817.69
8.1.40.0000.00917.68
8.1.30.0090.00017.77
8.1.20.0040.00417.67
8.1.10.0040.00417.71
8.1.00.0030.00517.48
8.0.300.0050.00318.77
8.0.290.0030.00516.63
8.0.280.0000.00718.48
8.0.270.0070.00017.21
8.0.260.0030.00317.30
8.0.250.0080.00017.10
8.0.240.0070.00017.00
8.0.230.0030.00317.03
8.0.220.0040.00717.02
8.0.210.0030.00317.04
8.0.200.0000.00617.05
8.0.190.0040.00417.01
8.0.180.0000.00816.95
8.0.170.0040.00417.02
8.0.160.0000.00816.91
8.0.150.0030.00517.02
8.0.140.0000.00716.98
8.0.130.0070.00013.46
8.0.120.0030.00617.04
8.0.110.0040.00416.84
8.0.100.0040.00416.96
8.0.90.0000.00816.88
8.0.80.0130.00717.04
8.0.70.0000.00717.04
8.0.60.0030.00516.95
8.0.50.0040.00416.88
8.0.30.0120.00817.21
8.0.20.0100.00817.40
8.0.10.0000.00717.12
8.0.00.0100.00816.94
7.4.330.0050.00016.84
7.4.320.0050.00216.75
7.4.300.0000.00616.68
7.4.290.0030.00316.59
7.4.280.0000.00816.58
7.4.270.0000.00716.66
7.4.260.0070.00016.70
7.4.250.0000.00716.67
7.4.240.0040.00416.78
7.4.230.0000.00716.80
7.4.220.0130.00616.62
7.4.210.0090.00616.73
7.4.200.0040.00416.56
7.4.160.0080.00816.59
7.4.150.0070.01017.40
7.4.140.0170.00817.86
7.4.130.0080.01016.70
7.4.120.0110.00616.72
7.4.110.0110.00716.63
7.4.100.0140.00716.70
7.4.90.0160.00016.67
7.4.80.0090.00919.39
7.4.70.0140.00416.69
7.4.60.0060.00916.58
7.4.50.0120.00416.80
7.4.40.0070.01016.68
7.4.30.0190.00316.59
7.4.00.0000.01115.21
7.3.330.0000.00813.33
7.3.320.0000.00613.33
7.3.310.0070.00016.13
7.3.300.0030.00316.22
7.3.290.0100.00416.32
7.3.280.0070.00916.35
7.3.270.0110.00917.40
7.3.260.0130.00316.64
7.3.250.0110.00716.47
7.3.240.0060.01416.51
7.3.230.0070.01016.52
7.3.210.0140.00316.61
7.3.200.0080.01116.46
7.3.190.0080.00816.56
7.3.180.0030.01416.61
7.3.170.0060.01316.68
7.3.160.0090.00616.29
7.3.10.0030.00916.49
7.3.00.0100.00516.52
7.2.330.0090.01516.57
7.2.320.0100.01416.90
7.2.310.0150.00616.77
7.2.300.0080.00916.92
7.2.290.0070.01016.71
7.2.130.0060.00816.97
7.2.120.0040.01016.99
7.2.110.0030.01016.73
7.2.100.0110.00516.74
7.2.90.0060.00716.84
7.2.80.0090.00516.87
7.2.70.0090.00716.86
7.2.60.0080.00517.03
7.2.50.0050.01016.80
7.2.40.0050.01216.87
7.2.30.0040.00916.85
7.2.20.0060.00716.67
7.2.10.0070.00816.82
7.2.00.0060.00417.69
7.1.250.0070.00615.71
7.1.100.0090.00618.14
7.1.70.0040.01217.04
7.1.60.0100.01619.36
7.1.50.0070.01016.86
7.1.00.0030.07722.32
7.0.200.0040.00416.95
7.0.60.0230.05719.97
7.0.50.0070.06017.89
7.0.40.0000.05720.07
7.0.30.0430.06020.08
7.0.20.0270.07720.25
7.0.10.0000.05020.32
7.0.00.0030.07720.13
5.6.280.0130.06321.12
5.6.210.0000.09020.65
5.6.200.0100.08018.16
5.6.190.0100.08320.39
5.6.180.0370.05720.79
5.6.170.0300.07720.44
5.6.160.0070.05720.43
5.6.150.0000.04018.21
5.6.140.0000.04318.14
5.6.130.0030.08318.25
5.6.120.0130.08721.10
5.6.110.0070.06021.00
5.6.100.0300.06021.14
5.6.90.0170.07721.00
5.6.80.0170.07020.38
5.5.350.4230.03720.41
5.5.340.0100.07717.96
5.5.330.0030.04720.35
5.5.320.0070.05020.52
5.5.310.0230.03720.27
5.5.300.0130.07318.06
5.5.290.0030.09017.95
5.5.280.0070.04020.96
5.5.270.0100.07720.88
5.5.260.0100.07020.88
5.5.250.0100.07720.77
5.5.240.0270.07320.19

preferences:
51.46 ms | 400 KiB | 5 Q