3v4l.org

run code in 500+ PHP versions simultaneously
<?php echo "Testing DOMDocument::createElement() with strictErrorChecking:\n"; echo "PHP Version: " . PHP_VERSION . "\n\n"; function testWithStrictMode($strict) { $doc = new DOMDocument(); $doc->strictErrorChecking = $strict; echo "=== strictErrorChecking = " . ($strict ? "TRUE" : "FALSE") . " ===\n"; $testCases = [ ['123element', 'Name starting with digit'], ['my element', 'Name with space'], ['my@element', 'Name with @ symbol'], ['', 'Empty name'], ['!element', 'Name with exclamation'], ['elem&ent', 'Name with ampersand'], ['.element', 'Name starting with dot'], ['-element', 'Name starting with hyphen'], ['validElement', 'Valid name'], ]; foreach ($testCases as [$name, $desc]) { echo str_pad("$desc ('$name'):", 40); try { $result = $doc->createElement($name); if ($result === false) { echo "Returned FALSE\n"; } else { echo "SUCCESS (" . $result->nodeName . ")\n"; } } catch (DOMException $e) { echo "EXCEPTION: " . $e->getMessage() . "\n"; } } echo "\n"; } // Test with strict error checking enabled (default) testWithStrictMode(true); // Test with strict error checking disabled (legacy behavior) testWithStrictMode(false);

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.5.30.0110.00719.63
8.5.20.0090.00919.98
8.5.10.0130.00916.99
8.5.00.0100.01222.84
8.4.180.0150.00919.95
8.4.170.0130.00923.86
8.4.160.0120.01322.15
8.4.150.0080.00516.96
8.4.140.0180.00717.60
8.4.130.0110.01419.38
8.4.120.0100.01317.73
8.4.110.0140.01019.53
8.4.100.0120.01317.79
8.4.90.0100.01319.59
8.4.80.0140.01017.76
8.4.70.0130.01219.79
8.4.60.0170.01317.84
8.4.50.0170.01118.00
8.4.40.0160.01117.94
8.4.30.0210.00717.78
8.4.20.0160.00917.82
8.4.10.0140.01118.11
8.3.300.0100.01020.88
8.3.290.0140.00720.75
8.3.280.0060.00517.23
8.3.270.0160.00716.61
8.3.260.0140.01016.94
8.3.250.0160.00816.53
8.3.240.0150.01116.37
8.3.230.0200.00716.38
8.3.220.0120.01016.60
8.3.210.0120.00616.68
8.3.200.0180.00816.82
8.3.190.0130.00916.57
8.3.180.0130.01116.70
8.3.170.0160.00716.79
8.3.160.0160.00916.71
8.3.150.0130.01116.44
8.3.140.0170.00616.60
8.3.130.0130.00817.09
8.3.120.0120.00916.80
8.3.110.0130.01016.55
8.3.100.0120.00916.62
8.3.90.0170.00616.81
8.3.80.0170.00716.66
8.3.70.0110.01016.48
8.3.60.0110.01116.84
8.3.50.0110.01116.78
8.3.40.0140.00717.54
8.3.30.0140.00717.47
8.3.20.0160.00717.37
8.3.10.0220.00817.29
8.3.00.0220.00717.33
8.2.300.0130.01220.23
8.2.290.0220.00716.64
8.2.280.0220.00816.79
8.2.270.0240.00816.16
8.2.260.0270.00416.05
8.2.250.0230.01316.03
8.2.240.0250.00516.39
8.2.230.0210.01016.34
8.2.220.0210.00816.40
8.2.210.0260.00716.36
8.2.200.0210.01316.78
8.2.190.0230.00916.55
8.2.180.0250.00516.34
8.2.170.0310.00617.28
8.2.160.0250.01117.11
8.2.150.0220.01017.54
8.2.140.0260.00917.19
8.2.130.0210.01416.93
8.2.120.0270.01117.40
8.2.110.0250.01017.22
8.2.100.0200.00717.17
8.2.90.0210.00917.48
8.2.80.0210.01017.65
8.2.70.0250.00817.18
8.2.60.0260.00917.18
8.2.50.0240.00617.34
8.2.40.0260.00817.06
8.2.30.0310.00917.04
8.2.20.0250.00617.09
8.2.10.0260.00917.27
8.2.00.0330.00817.05
8.1.340.0120.01121.86

preferences:
57.89 ms | 1016 KiB | 5 Q