3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = '<p>I am <30 years old and weight <12st</p>'; $libxmlErrorState = libxml_use_internal_errors(true); function getLastErrorPos($code) { $errors = array_filter(libxml_get_errors(), function ($e) use ($code) { return $e->code === $code; }); if ( !$errors ) return false; $lastError = array_pop($errors); return ['line' => $lastError->line - 1, 'column' => $lastError->column - 2 ]; } define('XML_ERR_NAME_REQUIRED', 68); // xmlParseEntityRef: no name $patternTemplate = '~(?:.*\R){%d}.{%d}\K<~A'; $dom = new DOMDocument; $dom->loadHTML($s, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED); while ( false !== $position = getLastErrorPos(XML_ERR_NAME_REQUIRED) ) { libxml_clear_errors(); $pattern = vsprintf($patternTemplate, $position); $s = preg_replace($pattern, '&lt;', $s, 1); $dom = new DOMDocument; $dom->loadHTML($s, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED); } echo $dom->saveHTML(); libxml_clear_errors(); libxml_use_internal_errors($libxmlErrorState);

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.80.0040.00718.80
8.3.70.0140.00717.00
8.3.60.0190.00318.80
8.3.50.0120.00817.78
8.3.40.0060.01019.20
8.3.30.0060.00919.39
8.3.20.0090.00621.24
8.3.10.0040.00422.16
8.3.00.0040.00423.78
8.2.200.0060.00316.88
8.2.190.0150.00619.16
8.2.180.0120.00616.88
8.2.170.0100.00722.96
8.2.160.0140.00320.47
8.2.150.0080.00025.66
8.2.140.0080.00024.66
8.2.130.0070.00726.16
8.2.120.0100.01026.16
8.2.110.0100.00022.45
8.2.100.0090.00318.47
8.2.90.0000.00820.07
8.2.80.0080.00018.41
8.2.70.0040.00418.18
8.2.60.0040.00418.47
8.2.50.0000.00818.13
8.2.40.0030.00621.52
8.2.30.0040.00419.72
8.2.20.0040.00418.46
8.2.10.0050.00219.66
8.2.00.0000.00719.68
8.1.290.0030.00630.84
8.1.280.0190.00325.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0060.00928.09
8.1.240.0090.00022.39
8.1.230.0070.00419.35
8.1.220.0080.00018.16
8.1.210.0090.00018.77
8.1.200.0030.00717.73
8.1.190.0030.00617.75
8.1.180.0060.00318.10
8.1.170.0060.00319.14
8.1.160.0000.00719.11
8.1.150.0040.00419.30
8.1.140.0040.00419.20
8.1.130.0000.00720.38
8.1.120.0050.00217.80
8.1.110.0060.00317.76
8.1.100.0020.00517.79
8.1.90.0000.01117.86
8.1.80.0000.00817.82
8.1.70.0070.00017.88
8.1.60.0000.00817.89
8.1.50.0000.00917.80
8.1.40.0040.00517.89
8.1.30.0040.00418.05
8.1.20.0000.01018.03
8.1.10.0000.00817.97
8.1.00.0000.00817.83
8.0.300.0070.00019.98
8.0.290.0060.00317.00
8.0.280.0000.00818.93
8.0.270.0030.00317.35
8.0.260.0030.00318.60
8.0.250.0040.00717.25
8.0.240.0040.00417.27
8.0.230.0030.00317.33
8.0.220.0000.01017.29
8.0.210.0000.00817.27
8.0.200.0000.00817.30
8.0.190.0080.00017.30
8.0.180.0030.00317.23
8.0.170.0090.00017.30
8.0.160.0000.00717.21
8.0.150.0080.00017.18
8.0.140.0040.00417.20
8.0.130.0000.00613.75
8.0.120.0030.00617.21
8.0.110.0000.00817.33
8.0.100.0040.00417.31
8.0.90.0000.00717.18
8.0.80.0090.00917.14
8.0.70.0000.00717.08
8.0.60.0050.00317.19
8.0.50.0050.00217.18
8.0.30.0130.00817.42
8.0.20.0130.01017.42
8.0.10.0050.00217.19
8.0.00.0090.01217.21
7.4.330.0000.00615.55
7.4.320.0070.00017.00
7.4.300.0030.00316.83
7.4.290.0000.00816.93
7.4.280.0040.00417.00
7.4.270.0070.00416.92
7.4.260.0030.00317.05
7.4.250.0000.00716.80
7.4.240.0040.00416.99
7.4.230.0050.00316.95
7.4.220.0030.00616.81
7.4.210.0070.00817.15
7.4.200.0040.00417.11
7.4.160.0080.00816.83
7.4.130.0060.01216.84
7.4.120.0100.00717.18
7.4.110.0100.01616.91
7.4.100.0150.00316.79
7.4.90.0130.00416.94
7.4.80.0130.00319.39
7.4.70.0100.01016.95
7.4.60.0030.01316.76
7.4.50.0060.01116.66
7.4.40.0070.01016.88
7.4.00.0070.00915.18
7.3.330.0030.00313.57
7.3.320.0000.00613.62
7.3.310.0030.00316.75
7.3.300.0000.00716.82
7.3.290.0080.00916.67
7.3.280.0160.01216.64
7.3.260.0120.00916.85
7.3.240.0080.01016.91
7.3.230.0100.01517.09
7.3.210.0030.01316.86
7.3.200.0110.00616.71
7.3.190.0080.00816.71
7.3.180.0030.01317.01
7.3.170.0090.00616.86
7.3.160.0060.01016.75
7.3.120.0030.01415.11
7.3.110.0070.01014.74
7.3.100.0070.00715.14
7.3.90.0060.00915.09
7.3.80.0070.00715.32
7.3.70.0100.00314.96
7.3.60.0080.00415.07
7.3.50.0110.00215.03
7.3.40.0030.01014.99
7.3.30.0040.01015.13
7.3.20.0070.00915.96
7.3.10.0120.00616.09
7.3.00.0040.01316.00
7.2.330.0100.00717.02
7.2.320.0130.00617.12
7.2.310.0100.00717.09
7.2.300.0070.01017.23
7.2.290.0100.00717.11
7.2.250.0060.01215.38
7.2.240.0040.01515.23
7.2.230.0040.01115.13
7.2.220.0090.00615.10
7.2.210.0100.00315.47
7.2.200.0000.01615.17
7.2.190.0050.00915.22
7.2.180.0100.00315.37
7.2.170.0020.01015.23
7.2.160.0030.01215.46
7.2.150.0130.00815.41
7.2.140.0230.00715.15
7.2.130.0070.01415.39
7.2.120.0140.00615.64
7.2.110.0030.01615.40
7.2.100.0150.00415.21
7.2.90.0080.00815.25
7.2.80.0150.00315.48
7.2.70.0180.00015.43
7.2.60.0090.00615.18
7.2.50.0150.00615.43
7.2.40.0140.00615.62
7.2.30.0030.01615.48
7.2.20.0100.01015.39
7.2.10.0060.00915.50
7.2.00.0200.00315.44
7.1.330.0110.00416.04
7.1.320.0000.01315.94
7.1.310.0030.01216.13
7.1.300.0120.00515.23
7.1.290.0120.00614.98
7.1.280.0030.00915.05
7.1.270.0090.00715.20
7.1.260.0090.00415.17
7.1.250.1340.00714.39

preferences:
27.89 ms | 401 KiB | 5 Q