3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stripTagFormatting(DOMText $textNode) { $css = []; $existingStyles = ''; $currentNode = $textNode->parentNode; do { switch (strtolower($currentNode->tagName)) { case 'font': if ($currentNode->hasAttribute('color') && !isset($css['color'])) { $css['color'] = $currentNode->getAttribute('color'); } if ($currentNode->hasAttribute('size') && !isset($css['font-size'])) { $css['font-size'] = $currentNode->getAttribute('size') . 'px'; } if ($currentNode->hasAttribute('face') && !isset($css['font-family'])) { $css['font-family'] = $currentNode->getAttribute('face'); } break; case 'b': if (!isset($css['font-weight'])) { $css['font-weight'] = 'bold'; } break; case 'i': if (!isset($css['font-style'])) { $css['font-style'] = 'italic'; } break; default: if ($currentNode->hasAttribute('style')) { $existingStyles = $currentNode->getAttribute('style'); } break 2; } } while($currentNode->parentNode->childNodes->length == 1 && $currentNode = $currentNode->parentNode); var_dump($currentNode->tagName, $css); } $html = '<FONT FACE="League" SIZE="15" COLOR="#000000"><font COLOR="#ff00ff" SIZE="18"><b><font SIZE="23"><font SIZE="27"><font SIZE="23"><font SIZE="18"><font SIZE="23">Moet Flip make-up dragen? <br />Stem mee in de poll!!</font></font></font></font></font></b></font><br /></FONT>'; $dom = new DOMDOcument(); $dom->loadHTML($html); $xpath = new DOMXPath($dom); $nodes = $xpath->evaluate("/html/body//text()"); foreach ($nodes as $node) { stripTagFormatting($node); } var_dump($dom->saveHTML());

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.01217.00
8.3.50.0110.00522.19
8.3.40.0120.00619.20
8.3.30.0110.00419.20
8.3.20.0060.00320.59
8.3.10.0060.00624.08
8.3.00.0000.00821.02
8.2.180.0110.01116.88
8.2.170.0090.00622.96
8.2.160.0080.01220.77
8.2.150.0080.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00421.26
8.2.110.0070.00319.62
8.2.100.0090.00318.41
8.2.90.0060.00318.00
8.2.80.0030.00519.16
8.2.70.0050.00318.00
8.2.60.0040.00419.73
8.2.50.0050.00318.00
8.2.40.0030.00620.57
8.2.30.0080.00018.59
8.2.20.0080.00018.13
8.2.10.0000.00818.38
8.2.00.0050.00318.10
8.1.280.0120.00325.92
8.1.270.0060.00322.56
8.1.260.0080.00026.35
8.1.250.0140.00328.09
8.1.240.0100.00317.61
8.1.230.0080.00421.28
8.1.220.0030.00518.95
8.1.210.0000.00818.77
8.1.200.0030.00517.60
8.1.190.0030.00517.60
8.1.180.0040.00418.10
8.1.170.0030.00618.81
8.1.160.0000.00822.27
8.1.150.0040.00419.02
8.1.140.0060.00317.85
8.1.130.0000.00718.16
8.1.120.0050.00317.83
8.1.110.0040.00417.77
8.1.100.0030.00717.84
8.1.90.0000.00717.86
8.1.80.0030.00517.75
8.1.70.0000.00717.70
8.1.60.0030.00617.96
8.1.50.0030.00517.92
8.1.40.0000.00917.94
8.1.30.0030.00617.92
8.1.20.0040.00417.97
8.1.10.0050.00317.88
8.1.00.0030.00517.90
8.0.300.0000.00718.80
8.0.290.0040.00417.13
8.0.280.0050.00318.79
8.0.270.0000.00717.70
8.0.260.0000.00717.58
8.0.250.0000.00817.26
8.0.240.0040.00417.26
8.0.230.0040.00417.21
8.0.220.0000.00717.35
8.0.210.0070.00017.19
8.0.200.0090.00017.25
8.0.190.0030.00517.43
8.0.180.0000.00717.23
8.0.170.0060.00317.39
8.0.160.0050.00317.30
8.0.150.0000.00817.30
8.0.140.0040.00417.30
8.0.130.0030.00313.63
8.0.120.0040.00417.21
8.0.110.0000.00817.15
8.0.100.0030.00517.24
8.0.90.0030.00517.34
8.0.80.0040.01317.37
8.0.70.0040.00417.24
8.0.60.0050.00317.33
8.0.50.0040.00417.34
8.0.30.0110.00917.52
8.0.20.0090.01217.41
8.0.10.0040.00417.50
8.0.00.0110.00917.04
7.4.330.0000.00615.00
7.4.320.0060.00016.82
7.4.300.0000.00616.80
7.4.290.0040.00416.86
7.4.280.0040.00416.96
7.4.270.0040.00416.93
7.4.260.0040.00416.84
7.4.250.0080.00016.84
7.4.240.0010.00616.92
7.4.230.0000.00916.89
7.4.220.0110.00716.84
7.4.210.0090.00616.75
7.4.200.0040.00417.07
7.4.160.0070.01016.95
7.4.150.0110.01117.40
7.4.140.0120.01117.86
7.4.130.0080.01016.89
7.4.120.0110.00916.91
7.4.110.0060.01216.95
7.4.100.0140.00316.67
7.4.90.0100.01617.13
7.4.80.0150.00719.39
7.4.70.0090.00916.88
7.4.60.0120.00616.78
7.4.50.0000.00816.71
7.4.40.0120.00617.03
7.4.30.0030.02016.98
7.4.10.0070.01316.58
7.4.00.0070.00716.04
7.3.330.0020.00513.70
7.3.320.0030.00313.60
7.3.310.0070.00016.75
7.3.300.0000.00716.66
7.3.290.0100.00716.67
7.3.280.0070.01016.70
7.3.270.0120.00417.40
7.3.260.0170.00616.72
7.3.250.0130.00816.76
7.3.240.0070.01016.81
7.3.230.0090.00916.65
7.3.210.0110.00716.95
7.3.200.0140.00516.77
7.3.190.0060.01216.72
7.3.180.0090.00616.90
7.3.170.0130.01116.73
7.3.160.0080.00816.72
7.3.130.0090.00916.61
7.3.120.0100.00515.74
7.3.110.0110.00716.68
7.3.100.0000.01116.56
7.3.90.0060.00616.71
7.3.80.0100.00716.71
7.3.70.0030.00616.55
7.3.60.0070.00716.75
7.3.50.0060.00916.46
7.3.40.0070.00716.63
7.3.30.0060.00316.61
7.3.20.0090.00618.48
7.3.10.0070.00718.59
7.3.00.0030.00918.43
7.2.330.0100.01417.19
7.2.320.0080.01117.17
7.2.310.0120.00617.15
7.2.300.0110.00617.03
7.2.290.0150.00317.23
7.2.260.0070.01416.77
7.2.250.0030.01716.72
7.2.240.0140.00416.88
7.2.230.0100.01017.16
7.2.220.0030.00717.04
7.2.210.0040.01216.63
7.2.200.0000.01016.67
7.2.190.0030.01016.81
7.2.180.0030.01316.75
7.2.170.0000.01116.87
7.2.160.0080.00416.80
7.2.150.0060.00618.70
7.2.140.0070.01018.75
7.2.130.0070.00418.84
7.2.120.0090.00918.70
7.2.110.0100.00318.71
7.2.100.0060.01018.61
7.2.90.0000.01218.70
7.2.80.0060.01018.73
7.2.70.0060.01418.95
7.2.60.0100.00618.03
7.2.50.0070.01118.50
7.2.40.0060.01618.84
7.2.30.0070.01718.61
7.2.20.0080.01118.76
7.2.10.0140.01018.80
7.2.00.0040.01419.31
7.1.330.0060.00917.86
7.1.320.0090.00917.77
7.1.310.0090.00917.57
7.1.300.0070.01017.84
7.1.290.0090.00617.61
7.1.280.0040.00817.93
7.1.270.0000.01117.73
7.1.260.0040.00717.75
7.1.250.0120.00317.63
7.1.240.0070.01017.64
7.1.230.0070.00717.57
7.1.220.0060.00617.62
7.1.210.0030.00717.64
7.1.200.0030.01316.84
7.1.190.0110.00717.51
7.1.180.0090.00917.53
7.1.170.0070.01117.71
7.1.160.0140.00017.58
7.1.150.0130.00517.44
7.1.140.0090.00617.56
7.1.130.0060.00917.64
7.1.120.0030.01217.54
7.1.110.0030.01317.61
7.1.100.0060.00918.03
7.1.90.0100.00717.76
7.1.80.0070.01017.75
7.1.70.0050.00617.46
7.1.60.0040.01718.62
7.1.50.0070.01217.28
7.1.40.0030.01317.32
7.1.30.0090.00317.57
7.1.20.0090.00317.59
7.1.10.0070.01017.51
7.1.00.0090.04020.15
7.0.330.0030.00617.23
7.0.320.0040.01117.35
7.0.310.0070.00317.26
7.0.300.0030.01617.50
7.0.290.0060.01517.40
7.0.280.0140.00617.29
7.0.270.0090.00617.36
7.0.260.0040.00717.38
7.0.250.0000.01217.24
7.0.240.0040.00717.45
7.0.230.0070.00717.40
7.0.220.0070.01017.32
7.0.210.0060.00617.31
7.0.200.0090.01017.04
7.0.190.0130.00317.36
7.0.180.0060.00617.38
7.0.170.0030.00717.15
7.0.160.0090.00617.36
7.0.150.0100.00617.48
7.0.140.0020.04419.80
7.0.130.0030.00817.38
7.0.120.0000.01217.39
7.0.110.0030.01017.52
7.0.100.0030.01017.42
7.0.90.0040.01117.36
7.0.80.0070.00717.39
7.0.70.0030.01217.41
7.0.60.0070.03018.77
7.0.50.0120.04217.71
7.0.40.0090.02317.76
7.0.30.0190.02117.90
7.0.20.0220.03817.73
7.0.10.0020.04917.81
7.0.00.0070.02617.96
5.6.400.0140.00016.00
5.6.390.0090.00616.14
5.6.380.0110.00716.59
5.6.370.0000.01416.34
5.6.360.0100.01016.48
5.6.350.0120.00616.13
5.6.340.0050.01616.56
5.6.330.0100.00716.11
5.6.320.0080.00816.64
5.6.310.0140.00316.11
5.6.300.0060.01016.14
5.6.290.0180.00416.45
5.6.280.0060.04118.64
5.6.270.0030.00616.29
5.6.260.0060.00916.04
5.6.250.0110.00616.39
5.6.240.0030.01216.50
5.6.230.0030.01216.51
5.6.220.0140.00316.34
5.6.210.0120.04218.53
5.6.200.0050.02917.38
5.6.190.0100.02218.34
5.6.180.1740.02118.54
5.6.170.0200.04018.58
5.6.160.0100.04018.44
5.6.150.0070.04717.25
5.6.140.0080.04317.31
5.6.130.0040.04717.29
5.6.120.0050.03218.71
5.6.110.0050.03418.74
5.6.100.0060.02418.67
5.6.90.0050.04818.73
5.6.80.0060.04618.41
5.6.70.1800.02218.35
5.6.60.0030.01216.01
5.6.50.0100.00616.25
5.6.40.0040.01116.10
5.6.30.0030.00916.36
5.6.20.0110.00316.04
5.6.10.0030.01216.14
5.6.00.0000.01516.14
5.5.380.0050.00916.32
5.5.370.0060.00616.26
5.5.360.0150.00416.13
5.5.350.0200.03818.42
5.5.340.0100.02817.06
5.5.330.0090.03018.45
5.5.320.0160.02318.38
5.5.310.0150.04518.39
5.5.300.0050.03617.25
5.5.290.0080.04517.28
5.5.280.0120.04018.69
5.5.270.0020.03218.68
5.5.260.0030.05018.60
5.5.250.0050.02518.48
5.5.240.0170.04418.24
5.5.230.0130.00716.20
5.5.220.0120.00416.26
5.5.210.0070.01016.27
5.5.200.0090.01215.96
5.5.190.0090.00616.22
5.5.180.0100.00616.32
5.5.170.0130.00616.10
5.5.160.0030.01016.27
5.5.150.0120.00816.04
5.5.140.0060.01016.14
5.5.130.0100.00715.87
5.5.120.0100.01016.06
5.5.110.0000.01716.05
5.5.100.0090.00316.11
5.5.90.0030.01416.18
5.5.80.0090.00616.24
5.5.70.0070.00716.25
5.5.60.0110.00716.08
5.5.50.0110.00316.27
5.5.40.0090.00516.24
5.5.30.0120.00616.07
5.5.20.0100.00715.94
5.5.10.0140.00416.17
5.5.00.0080.00416.16
5.4.450.0270.03020.25
5.4.440.0080.02820.71
5.4.430.0130.02919.69
5.4.420.0130.03019.65
5.4.410.0140.02619.66
5.4.400.0170.02219.56
5.4.390.0130.03019.50
5.4.380.0060.03615.79
5.4.370.0070.03415.88
5.4.360.0100.02715.98
5.4.350.0080.03415.87
5.4.340.0060.04616.02
5.4.330.0080.00813.13
5.4.320.0050.02312.84
5.4.310.0060.02312.86
5.4.300.0070.03012.74
5.4.290.0060.03312.80
5.4.280.0140.05612.78
5.4.270.0130.05912.90
5.4.260.0110.06012.77
5.4.250.0090.04712.89
5.4.240.0160.05812.90
5.4.230.0160.04312.79
5.4.220.0060.03512.84
5.4.210.0040.03712.78
5.4.200.0070.03112.81
5.4.190.0070.03412.80
5.4.180.0110.02912.88
5.4.170.0100.03212.82
5.4.160.0090.03212.88
5.4.150.0090.03312.81
5.4.140.0060.03412.68
5.4.130.0070.02712.74
5.4.120.0090.02812.60
5.4.110.0070.03212.75
5.4.100.0080.02912.61
5.4.90.0070.03312.63
5.4.80.0060.03312.58
5.4.70.0110.02812.69
5.4.60.0060.03212.69
5.4.50.0070.04012.57
5.4.40.0080.02912.67
5.4.30.0070.03312.61
5.4.20.0070.03812.66
5.4.10.0150.05312.62
5.4.00.0150.06112.36
5.3.290.0080.02412.79
5.3.280.0050.03612.75
5.3.270.0090.03612.72
5.3.260.0180.03712.71
5.3.250.0110.03512.66
5.3.240.0140.03312.70
5.3.230.0140.03812.62
5.3.220.0160.04012.67
5.3.210.0090.04212.67
5.3.200.0120.02812.68
5.3.190.0110.03112.65
5.3.180.0170.05012.69
5.3.170.0110.05812.75
5.3.160.0090.04712.87
5.3.150.0170.03112.74
5.3.140.0160.04112.71
5.3.130.0110.04512.72
5.3.120.0080.03312.69
5.3.110.0110.03312.71
5.3.100.0100.03612.46
5.3.90.0110.03512.47
5.3.80.0130.02812.37
5.3.70.0110.02912.42
5.3.60.0150.02912.46
5.3.50.0100.02912.27
5.3.40.0120.02612.37
5.3.30.0100.02312.47
5.3.20.0090.02512.21
5.3.10.0090.02712.24
5.3.00.0150.02512.10
5.2.170.0040.0379.22
5.2.160.0070.0479.22
5.2.150.0110.0419.22
5.2.140.0090.0499.21
5.2.130.0090.0429.18
5.2.120.0090.0379.18
5.2.110.0080.0429.18
5.2.100.0090.0549.18
5.2.90.0070.0449.18
5.2.80.0060.0389.18
5.2.70.0040.0369.18
5.2.60.0060.0469.13
5.2.50.0050.0349.09
5.2.40.0080.0299.07
5.2.30.0060.0369.05
5.2.20.0090.0399.05
5.2.10.0080.0548.95
5.2.00.0060.0328.81
5.1.60.0070.0248.09
5.1.50.0060.0268.09
5.1.40.0090.0368.07
5.1.30.0090.0618.43
5.1.20.0130.0738.44
5.1.10.0040.0318.17
5.1.00.0080.0538.17
5.0.50.0030.0286.64
5.0.40.0080.0336.50
5.0.30.0050.0346.32
5.0.20.0060.0216.28
5.0.10.0030.0236.26
5.0.00.0220.0726.25
4.4.90.0110.0354.78
4.4.80.0160.0334.76
4.4.70.0050.0314.76
4.4.60.0050.0234.75
4.4.50.0100.0234.77
4.4.40.0040.0314.71
4.4.30.0070.0334.76
4.4.20.0040.0184.84
4.4.10.0140.0474.85
4.4.00.0090.0554.76
4.3.110.0050.0264.67
4.3.100.0050.0254.67
4.3.90.0060.0404.63
4.3.80.0030.0314.59
4.3.70.0040.0404.63
4.3.60.0110.0304.63
4.3.50.0050.0334.63
4.3.40.0120.0344.54
4.3.30.0160.0363.30
4.3.20.0040.0163.29
4.3.10.0030.0163.24
4.3.00.0070.01326.11

preferences:
40.25 ms | 401 KiB | 5 Q