3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Checks if a XML file's structure is valid. * @author Julius Beckmann <php@h4cc.de> * @param $file string * @return bool */ function isXmlStructureValid($file) { $prev = libxml_use_internal_errors(true); $ret = true; try { new SimpleXMLElement($file, 0, true); } catch(Exception $e) { $ret = false; } if(count(libxml_get_errors()) > 0) { // There has been XML errors $ret = false; } // Tidy up. libxml_clear_errors(); libxml_use_internal_errors($prev); return $ret; } $xml = "<?xml version='1.0'?> <html> <head><title>411 Length Required</title></head> <body bgcolor="white"> <center><h1>411 Length Required</h1></center> <center>nginx</center> </body> </html>"; var_dump(isXmlStructureValid($xml));

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)
5.5.30.0070.04317.22
5.5.20.0100.07017.31
5.5.10.0030.05017.16
5.5.00.0030.07317.21
5.4.190.0100.06718.88
5.4.180.0030.07319.08
5.4.170.0030.06718.97
5.4.160.0100.04319.08
5.4.150.0200.06019.04
5.4.140.0030.08016.30
5.4.130.0070.03316.59
5.4.120.0030.04716.39
5.4.110.0070.05016.49
5.4.100.0000.04016.49
5.4.90.0030.03716.30
5.4.80.0100.06316.38
5.4.70.0100.03716.30
5.4.60.0030.03716.34
5.4.50.0130.06716.32
5.4.40.0070.05316.51
5.4.30.0100.05316.40
5.4.20.0130.06016.27
5.4.10.0100.06716.43
5.4.00.0100.04715.84
5.3.270.0030.08714.62
5.3.260.0100.06714.68
5.3.250.0000.07314.46
5.3.240.0000.04314.66
5.3.230.0100.06014.56
5.3.220.0200.06314.53
5.3.210.0030.08314.56
5.3.200.0030.04314.58
5.3.190.0030.07714.62
5.3.180.0000.08314.52
5.3.170.0030.05314.59
5.3.160.0030.05014.52
5.3.150.0070.07314.52
5.3.140.0030.05714.62
5.3.130.0030.07314.60
5.3.120.0030.05714.54
5.3.110.0030.07014.64
5.3.100.0100.07314.04
5.3.90.0070.07714.23
5.3.80.0030.07014.08
5.3.70.0000.05014.03
5.3.60.0070.05713.98
5.3.50.0230.05013.96
5.3.40.0070.07313.95
5.3.30.0000.04713.96
5.3.20.0130.06713.91
5.3.10.0030.06713.69
5.3.00.0070.04713.66

preferences:
141.81 ms | 1394 KiB | 7 Q