3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Parser { // main public static function parse($xmlData) { $res = null; libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->recover = true; if(!$dom->loadXML($xmlData)) { $res['error'] = libxml_get_errors(); libxml_clear_errors(); } else { self::read($res, $dom); } return $res; } // tools // TODO use alternate class private static function parseText($str) { return trim(htmlentities($str)); } // void private static function read(&$res, &$dom) { $rss = $dom->getElementsByTagName('rss'); if($rss->length == 0) { $res['error'] = 'No rss node.'; } else { $channel = $rss->item(0)->getElementsByTagName('channel'); if($channel->length == 0) { $res['error'] = 'No channel node.'; } else { self::getNodes($res, $channel, array('title', 'link', 'description')); } } } private static function getNode(&$res, &$channel, $name) { $node = $channel->item(0)->getElementsByTagName($name); if($node->length == 0) { $res[$name] = null; } else { $res[$name] = self::parseText($node->item(0)->nodeValue); } } private static function getNodes(&$res, &$channel, $names) { foreach($names as $name) { self::getNode($res, $channel, $name); } } } $file = file_get_contents('http://korben.info/feed'); if(!$file) { echo 'err cannot read file'; // TODO curl internet } else { $res = Parser::parse($file); var_dump($res); }

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.0040.01417.13
8.3.50.0090.00922.06
8.3.40.0150.00019.09
8.3.30.0150.00019.11
8.3.20.0110.00720.57
8.3.10.0050.00322.15
8.3.00.0040.00422.20
8.2.180.0120.00316.74
8.2.170.0150.00022.96
8.2.160.0040.01120.57
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00421.18
8.2.120.0040.00426.35
8.2.110.0070.00319.29
8.2.100.0000.01218.18
8.2.90.0040.00419.34
8.2.80.0000.00817.97
8.2.70.0060.00318.00
8.2.60.0050.00318.05
8.2.50.0000.00818.09
8.2.40.0000.00820.89
8.2.30.0050.00219.75
8.2.20.0050.00317.81
8.2.10.0080.00018.37
8.2.00.0000.00918.18
8.1.280.0070.01025.92
8.1.270.0040.01222.57
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0090.00022.55
8.1.230.0040.00818.08
8.1.220.0000.00917.91
8.1.210.0060.00318.77
8.1.200.0100.00017.60
8.1.190.0030.00617.60
8.1.180.0030.00518.10
8.1.170.0050.00318.80
8.1.160.0060.00321.00
8.1.150.0030.00519.24
8.1.140.0090.00019.82
8.1.130.0040.00417.91
8.1.120.0000.00817.79
8.1.110.0050.00217.65
8.1.100.0000.00817.64
8.1.90.0000.00817.56
8.1.80.0070.00017.66
8.1.70.0000.00817.68
8.1.60.0060.00317.74
8.1.50.0040.00417.61
8.1.40.0030.00517.70
8.1.30.0000.00817.90
8.1.20.0040.00417.84
8.1.10.0000.00817.70
8.1.00.0000.00817.63
8.0.300.0040.00419.03
8.0.290.0030.00517.13
8.0.280.0070.00018.77
8.0.270.0030.00317.58
8.0.260.0000.00717.54
8.0.250.0000.00717.25
8.0.240.0040.00417.32
8.0.230.0070.00017.14
8.0.220.0040.00417.10
8.0.210.0070.00017.21
8.0.200.0060.00017.16
8.0.190.0000.01017.17
8.0.180.0030.00617.21
8.0.170.0040.00417.13
8.0.160.0000.00717.22
8.0.150.0040.00417.15
8.0.140.0070.00317.12
8.0.130.0060.00013.71
8.0.120.0040.00417.23
8.0.110.0000.00817.27
8.0.100.0040.00417.24
8.0.90.0000.00817.30
8.0.80.0100.00717.31
8.0.70.0060.00317.39
8.0.60.0040.00417.28
8.0.50.0000.00817.41
8.0.30.0100.00817.54
8.0.20.0130.00817.42
8.0.10.0040.00417.40
8.0.00.0110.00817.08
7.4.330.0050.00017.01
7.4.320.0070.00016.63
7.4.300.0000.00816.84
7.4.290.0030.00316.63
7.4.280.0000.00816.84
7.4.270.0070.00016.79
7.4.260.0000.00716.68
7.4.250.0030.00616.74
7.4.240.0080.00016.71
7.4.230.0040.00416.78
7.4.220.0120.00816.93
7.4.210.0040.01116.80
7.4.200.0040.00416.87
7.4.160.0090.00616.65
7.4.150.0090.01217.40
7.4.140.0130.00717.86
7.4.130.0110.00816.90
7.4.120.0120.00616.87
7.4.110.0030.01516.79
7.4.100.0160.00716.78
7.4.90.0100.01716.81
7.4.80.0070.01119.39
7.4.70.0090.00916.90
7.4.60.0060.01316.76
7.4.50.0040.01416.68
7.4.40.0090.00916.88
7.4.30.0030.01716.79
7.4.10.0060.01016.63
7.4.00.0100.00815.81
7.3.330.0030.00413.39
7.3.320.0030.00313.54
7.3.310.0030.00316.51
7.3.300.0070.00016.62
7.3.290.0100.00816.64
7.3.280.0090.00916.61
7.3.270.0060.01217.40
7.3.260.0180.00816.84
7.3.250.0160.00516.69
7.3.240.0080.01116.64
7.3.230.0110.00716.81
7.3.210.0120.00616.70
7.3.200.0100.00619.39
7.3.190.0130.01716.65
7.3.180.0120.00616.56
7.3.170.0130.00516.56
7.3.160.0110.00716.78
7.3.130.0100.01016.62
7.3.120.0090.01215.97
7.3.110.0050.01315.91
7.3.100.0020.01315.79
7.3.90.0050.00815.92
7.3.80.0030.00815.88
7.3.70.0040.00915.73
7.3.60.0090.00615.77
7.3.50.0030.01015.91
7.3.40.0080.00515.92
7.3.30.0070.00915.96
7.3.20.0030.01017.62
7.3.10.0060.00817.63
7.3.00.0100.00517.58
7.2.330.0060.01316.98
7.2.320.0150.01016.89
7.2.310.0090.00916.80
7.2.300.0140.00716.88
7.2.290.0040.01416.79
7.2.260.0130.00716.61
7.2.250.0110.00816.05
7.2.240.0120.00716.16
7.2.230.0030.01316.01
7.2.220.0090.00615.98
7.2.210.0060.00716.13
7.2.200.0120.00515.84
7.2.190.0090.00815.92
7.2.180.0100.00516.01
7.2.170.0030.01416.07
7.2.160.0070.00716.60
7.2.150.0100.00718.73
7.2.140.0090.00618.65
7.2.130.0080.00318.46
7.2.120.0040.00918.66
7.2.110.0110.01118.62
7.2.100.0100.00518.70
7.2.90.0110.00718.63
7.2.80.0100.00318.62
7.2.70.0070.01018.73
7.2.60.0050.00917.73
7.2.50.0070.00718.54
7.2.40.0080.01118.59
7.2.30.0120.00618.60
7.2.20.0100.00618.57
7.2.10.0000.01818.54
7.2.00.0050.00818.99
7.1.330.0100.00616.82
7.1.320.0040.00616.82
7.1.310.0100.00416.75
7.1.300.0040.00516.76
7.1.290.0060.00516.43
7.1.280.0100.00516.53
7.1.270.0030.00916.72
7.1.260.0100.00416.64
7.1.250.0030.00717.47
7.1.240.0120.00317.58
7.1.230.0040.01417.54
7.1.220.0060.00917.59
7.1.210.0090.00917.25
7.1.200.0040.01216.70
7.1.190.0110.00717.43
7.1.180.0030.00817.50
7.1.170.0030.01017.50
7.1.160.0070.00717.59
7.1.150.0040.01217.46
7.1.140.0030.00717.52
7.1.130.0040.00917.41
7.1.120.0060.00617.56
7.1.110.0040.00717.43
7.1.100.0060.00917.95
7.1.90.0080.00317.36
7.1.80.0100.00717.39
7.1.70.0040.00717.49
7.1.60.0070.01118.46
7.1.50.0030.01617.48
7.1.40.0100.00317.61
7.1.30.0040.01117.65
7.1.20.0000.01717.43
7.1.10.0160.00317.64
7.1.00.0070.03820.04
7.0.330.0140.00017.26
7.0.320.0070.00717.23
7.0.310.0070.01017.26
7.0.300.0100.00017.04
7.0.290.0030.00617.16
7.0.280.0110.00417.09
7.0.270.0060.01117.00
7.0.260.0000.01117.22
7.0.250.0030.01317.19
7.0.240.0030.01317.30
7.0.230.0030.00617.14
7.0.220.0040.01117.29
7.0.210.0060.01017.19
7.0.200.0270.00515.95
7.0.190.0100.00317.30
7.0.180.0030.00717.04
7.0.170.0100.00617.08
7.0.160.0030.01317.27
7.0.150.0040.01117.15
7.0.140.0080.00817.27
7.0.130.0070.00717.12
7.0.120.0030.01317.11
7.0.110.0000.00917.22
7.0.100.0060.00617.00
7.0.90.0060.00317.11
7.0.80.0060.01017.13
7.0.70.0030.01217.34
7.0.60.0120.04719.65
7.0.50.0080.02217.71
7.0.40.0090.04417.85
7.0.30.0080.02717.86
7.0.20.0200.03317.78
7.0.10.0050.04217.86
7.0.00.0050.04317.96
5.6.400.0130.00016.32
5.6.390.0160.00316.32
5.6.380.0100.00316.38
5.6.370.0100.00715.84
5.6.360.0130.00316.08
5.6.350.0030.00716.03
5.6.340.0090.00616.39
5.6.330.0000.01416.11
5.6.320.0030.01616.24
5.6.310.0070.01016.07
5.6.300.0060.00616.36
5.6.290.0000.01215.96
5.6.280.0030.04018.88
5.6.270.0070.01016.51
5.6.260.0030.00916.25
5.6.250.0000.01216.07
5.6.240.0110.00416.20
5.6.230.0060.00916.12
5.6.220.0120.00316.13
5.6.210.0100.04018.46
5.6.200.0210.01817.37
5.6.190.0100.03518.71
5.6.180.0210.03018.58
5.6.170.0200.03518.50
5.6.160.0030.02918.37
5.6.150.0060.02917.31
5.6.140.0070.04517.35
5.6.130.0070.04717.19
5.6.120.0050.04518.83
5.6.110.0100.03718.76
5.6.100.0080.04818.71
5.6.90.0060.02318.65
5.6.80.0070.04418.41
5.6.70.0070.00716.07
5.6.60.0070.00716.05
5.6.50.0040.01116.16
5.6.40.0040.01416.14
5.6.30.0030.00715.95
5.6.20.0080.00815.76
5.6.10.0070.00716.14
5.6.00.0110.00415.97
5.5.380.0070.01316.00
5.5.370.0070.01016.04
5.5.360.0040.01115.70
5.5.350.0020.04818.38
5.5.340.0060.02317.07
5.5.330.0060.04318.51
5.5.320.0130.02318.46
5.5.310.0170.04518.39
5.5.300.0140.04017.17
5.5.290.0090.02017.01
5.5.280.0080.04518.62
5.5.270.0100.03618.45
5.5.260.0070.02518.71
5.5.250.0140.03818.53
5.5.240.0130.04618.26
5.5.230.0030.01315.89
5.5.220.0060.00915.78
5.5.210.0030.01316.07
5.5.200.0000.01015.92
5.5.190.0030.01215.98
5.5.180.0140.00315.88
5.5.170.0000.01516.14
5.5.160.0060.01016.05
5.5.150.0030.00915.93
5.5.140.0070.00716.09
5.5.130.0110.00416.11
5.5.120.0000.01016.05
5.5.110.0120.00315.85
5.5.100.0060.00616.06
5.5.90.0090.00315.78
5.5.80.0060.01216.03
5.5.70.0040.01515.95
5.5.60.0040.01115.77
5.5.50.0030.00715.94
5.5.40.0000.01415.88
5.5.30.0080.00415.73
5.5.20.0030.01015.94
5.5.10.0030.00715.48
5.5.00.0070.01015.89

preferences:
54.68 ms | 401 KiB | 5 Q