3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tsId = 'XACCB84E44344C2EEB8714B3210DE2907'; $cacheFileName = $tsId.'.xml'; $cacheTimeOut = 43200; // half a day $apiUrl = 'http://www.trustedshops.com/api/ratings/v1/'.$tsId.'.xml'; $xmlFound = false;// check if cached version exists if (!cachecheck($cacheFileName, $cacheTimeOut)) { // load fresh from API $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_URL, $apiUrl); $output = curl_exec($ch); curl_close($ch); // Write the contents back to the file // Make sure you can write to file's destination file_put_contents($cacheFileName, $output);} if ($xml = simplexml_load_file($cacheFileName)) { $xPath = "/shop/ratings/result[@name='average']"; $result = (float) $xml -> xpath($xPath)[0]; $max = "5.00"; $count = $xml->ratings["amount"]; $shopName = $xml->name; $xmlFound = true;}if ($xmlFound) { ?> <a href="http://www.trustedshops.eu/seller-rating/">Trusted Shops seller rating</a>:<span xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Review-aggregate"> <span rel="v:rating"><span property="v:value"><?php echo $result;?> </span> </span> / <span property="v:best"><?php echo $max;?> </span> of <span property="v:count"><?php echo $count;?> </span> <a href="https://www.trustedshops.de/bewertung/info_<?php echo $tsId?>.html" title="<?php echo $shopName;?> bewertungen"> <?php echo $shopName;?> ratings</a> </span> <?php } function cachecheck($filename_cache, $timeout = 10800) { if (file_exists($filename_cache) && time() - filemtime($filename_cache) < $timeout) { return true; } return 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)
7.4.00.0150.00415.20
7.3.120.0060.01015.02
7.3.110.0060.00915.06
7.3.100.0070.00714.92
7.3.90.0070.00714.74
7.3.80.0040.01114.97
7.3.70.0000.01614.69
7.3.60.0100.00314.94
7.3.50.0060.00614.97
7.3.40.0040.00814.96
7.3.30.0000.01514.59
7.3.20.0030.00816.27
7.3.10.0060.00716.82
7.3.00.0030.00716.80
7.2.250.0100.01015.23
7.2.240.0030.01415.08
7.2.230.0000.01714.96
7.2.220.0040.01115.07
7.2.210.0070.01115.30
7.2.200.0090.00615.00
7.2.190.0070.01015.02
7.2.180.0040.01114.96
7.2.170.0080.00415.23
7.2.130.0030.01016.99
7.2.120.0000.01416.71
7.2.110.0100.00316.43
7.2.100.0090.00616.93
7.2.90.0120.00416.50
7.2.80.0080.00816.58
7.2.70.0090.00316.86
7.2.60.0120.01016.63
7.2.50.0040.00816.89
7.2.40.0030.00916.88
7.2.30.0040.00716.84
7.2.20.0030.00716.89
7.2.10.0040.01116.59
7.2.00.0050.00718.19
7.1.330.0100.00315.86
7.1.320.0000.01415.75
7.1.310.0050.00515.99
7.1.300.0130.00315.47
7.1.290.0030.01015.86
7.1.280.0030.01215.75
7.1.270.0060.00315.56
7.1.260.0070.01015.79
7.1.250.0030.00915.66
7.1.200.0000.01515.55
7.1.70.0040.00817.22
7.1.60.0900.00615.12
7.1.50.0130.01016.86
7.1.00.0030.07722.28
7.0.200.0040.01116.47
7.0.140.0000.07722.14
7.0.100.0100.07719.94
7.0.90.0070.06719.97
7.0.80.0070.08020.05
7.0.70.0130.04320.17
7.0.60.0030.04319.97
7.0.50.0030.08720.39
7.0.40.0000.09020.07
7.0.30.0000.09020.14
7.0.20.0070.06720.15
7.0.10.0070.08320.10
7.0.00.0070.05320.12
5.6.280.0070.07320.88
5.6.250.0270.05720.71
5.6.240.0030.05320.77
5.6.230.0070.04020.70
5.6.220.0030.08020.63
5.6.210.0200.06720.79
5.6.200.0030.06721.19
5.6.190.0000.07721.07
5.6.180.0230.06321.06
5.6.170.0200.06721.14
5.6.160.0070.04720.97
5.6.150.0100.04320.95
5.6.140.0070.04021.11
5.6.130.0030.09320.95
5.6.120.0070.06021.09
5.6.110.0200.07721.06
5.6.100.0030.05021.11
5.6.90.0100.04320.95
5.6.80.0100.07720.36
5.6.70.0000.05720.41
5.6.60.0030.05720.45
5.6.50.0070.08320.48
5.6.40.0200.07020.46
5.6.30.0100.04720.32
5.6.20.0100.04720.41
5.6.10.0070.08020.30
5.6.00.0070.08720.39
5.5.380.0070.07720.35
5.5.370.0070.03720.44
5.5.360.0070.04720.35
5.5.350.0000.07020.47
5.5.340.0100.04320.90
5.5.330.0130.04320.83
5.5.320.0070.07720.65
5.5.310.0070.05020.84
5.5.300.0100.07720.89
5.5.290.0070.05320.88
5.5.280.0170.07020.77
5.5.270.0130.07720.79
5.5.260.0070.05020.94
5.5.250.0130.07720.73
5.5.240.0030.05020.30
5.5.230.0070.04720.24
5.5.220.0100.07320.31
5.5.210.0130.05720.30
5.5.200.0070.07320.25
5.5.190.0070.08020.09
5.5.180.0100.07720.09
5.5.160.0030.08020.20
5.5.150.0100.04320.12
5.5.140.0070.08020.17
5.5.130.0070.04320.24
5.5.120.0170.03720.12
5.5.110.0070.07320.23
5.5.100.0130.05719.99
5.5.90.0170.06720.18
5.5.80.0070.07720.08
5.5.70.0170.06720.13
5.5.60.0070.08320.06
5.5.50.0100.05020.16
5.5.40.0070.07019.95
5.5.30.0130.06320.14
5.5.20.0100.07719.94
5.5.10.0070.07720.09
5.5.00.0070.08020.05
5.4.450.0070.08019.23
5.4.440.0100.08019.37
5.4.430.0130.04019.55
5.4.420.0070.04319.35
5.4.410.0070.07719.29
5.4.400.0130.07018.91
5.4.390.0170.03318.91
5.4.380.0130.07019.05
5.4.370.0070.07019.18
5.4.360.0100.08319.02
5.4.350.0200.07319.09
5.4.340.0070.08318.90
5.4.320.0070.08019.06
5.4.310.0130.06019.04
5.4.300.0000.07719.12
5.4.290.0100.04018.84
5.4.280.0030.07719.13
5.4.270.0130.03718.89
5.4.260.0100.08018.94
5.4.250.0070.06018.86
5.4.240.0100.04318.87
5.4.230.0070.08018.87
5.4.220.0070.07718.94
5.4.210.0000.08318.94
5.4.200.0100.07319.20
5.4.190.0070.08019.23
5.4.180.0030.07718.89
5.4.170.0070.07718.84
5.4.160.0170.06319.14
5.4.150.0100.04319.07
5.4.140.0100.04016.46
5.4.130.0070.05716.30
5.4.120.0100.07016.41
5.4.110.0100.06316.52
5.4.100.0100.05316.49
5.4.90.0100.06716.50
5.4.80.0070.07716.47
5.4.70.0070.05716.32
5.4.60.0130.06716.45
5.4.50.0070.08016.42
5.4.40.0070.07016.42
5.4.30.0100.06716.44
5.4.20.0000.08016.29
5.4.10.0100.07016.26
5.4.00.0000.04715.77
5.3.290.0100.08014.66
5.3.280.0070.08014.59
5.3.270.0130.06714.46
5.3.260.0130.06714.59
5.3.250.0070.06714.57
5.3.240.0000.07714.57
5.3.230.0030.04714.61
5.3.220.0070.06714.57
5.3.210.0070.08014.52
5.3.200.0030.04014.56
5.3.190.0030.04714.55
5.3.180.0030.07714.48
5.3.170.0170.06714.53
5.3.160.0100.07014.53
5.3.150.0070.06014.52
5.3.140.0070.04714.47
5.3.130.0130.07014.54
5.3.120.0100.07714.39
5.3.110.0030.07714.54
5.3.100.0030.03713.86
5.3.90.0070.07313.97
5.3.80.0130.04313.96
5.3.70.0030.04313.89
5.3.60.0030.04013.96
5.3.50.0100.03313.94
5.3.40.0030.04313.94
5.3.30.0070.03313.82
5.3.20.0000.03713.58
5.3.10.0000.03713.59
5.3.00.0130.02713.60
5.2.170.0030.03312.69
5.2.160.0030.03312.69
5.2.150.0030.03012.69
5.2.140.0000.03312.69
5.2.130.0030.04012.69
5.2.120.0030.03012.69
5.2.110.0000.05312.69
5.2.100.0030.02712.69
5.2.90.0000.05712.69
5.2.80.0000.03712.69
5.2.70.0030.05012.69
5.2.60.0030.03312.69
5.2.50.0000.04312.69
5.2.40.0030.03012.69
5.2.30.0000.03012.69
5.2.20.0000.03012.69
5.2.10.0000.03012.69
5.2.00.0030.02712.69
5.1.60.0030.04312.69
5.1.50.0000.02712.69
5.1.40.0070.04312.69
5.1.30.0070.02712.69
5.1.20.0000.02712.69
5.1.10.0030.02312.69
5.1.00.0000.02712.69
5.0.50.0030.01712.69
5.0.40.0000.02012.69
5.0.30.0030.04012.69
5.0.20.0000.02012.69
5.0.10.0000.02012.69
5.0.00.0030.03012.69
4.4.90.0000.01312.69
4.4.80.0000.01712.69
4.4.70.0000.02012.69
4.4.60.0100.00712.69
4.4.50.0070.01712.69
4.4.40.0000.02712.69
4.4.30.0000.01712.69
4.4.20.0070.02012.69
4.4.10.0070.02312.69
4.4.00.0000.02312.69
4.3.110.0000.01712.69
4.3.100.0000.01312.69
4.3.90.0030.01312.69
4.3.80.0000.02312.69
4.3.70.0030.01312.69
4.3.60.0000.01312.69
4.3.50.0070.02712.69
4.3.40.0000.02712.69
4.3.30.0000.01312.69
4.3.20.0030.02012.69
4.3.10.0000.02012.69
4.3.00.0000.01712.69

preferences:
34.85 ms | 401 KiB | 5 Q