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)
5.4.340.0070.03412.04
5.4.320.0070.03712.53
5.4.310.0080.03912.52
5.4.300.0040.04412.53
5.4.290.0070.03712.52
5.4.280.0060.03512.42
5.4.270.0050.03812.42
5.4.260.0080.04112.42
5.4.250.0050.03812.42
5.4.240.0080.04012.41
5.4.230.0080.03712.41
5.4.220.0040.03912.41
5.4.210.0030.04412.41
5.4.200.0070.04212.41
5.4.190.0110.04712.40
5.4.180.0060.03912.40
5.4.170.0050.03612.42
5.4.160.0030.03812.41
5.4.150.0040.03812.41
5.4.140.0060.03812.09
5.4.130.0060.03512.08
5.4.120.0050.04012.04
5.4.110.0060.03912.04
5.4.100.0070.03412.04
5.4.90.0060.03612.04
5.4.80.0080.03812.04
5.4.70.0030.03912.04
5.4.60.0050.03912.04
5.4.50.0090.03312.03
5.4.40.0050.03812.02
5.4.30.0030.04112.02
5.4.20.0030.03812.02
5.4.10.0070.03512.02
5.4.00.0080.03911.51
5.3.290.0070.04212.80
5.3.280.0050.04212.71
5.3.270.0070.03912.72
5.3.260.0070.03912.72
5.3.250.0100.05612.72
5.3.240.0100.04012.72
5.3.230.0050.05212.71
5.3.220.0080.04512.68
5.3.210.0160.05312.68
5.3.200.0100.04712.68
5.3.190.0100.04912.67
5.3.180.0070.04012.67
5.3.170.0050.03912.67
5.3.160.0060.03612.67
5.3.150.0080.03712.67
5.3.140.0090.03412.66
5.3.130.0110.04412.66
5.3.120.0120.05612.66
5.3.110.0090.04612.65
5.3.100.0080.04112.12
5.3.90.0050.04612.08
5.3.80.0060.03912.07
5.3.70.0050.03812.08
5.3.60.0070.03612.06
5.3.50.0140.07312.00
5.3.40.0050.03812.00
5.3.30.0070.04911.95
5.3.20.0050.03811.73
5.3.10.0040.03711.70
5.3.00.0080.03811.69
5.2.170.0070.0329.19
5.2.160.0060.0289.19
5.2.150.0070.0299.19
5.2.140.0040.0449.18
5.2.130.0080.0399.14
5.2.120.0050.0369.14
5.2.110.0030.0369.15
5.2.100.0030.0309.14
5.2.90.0070.0289.14
5.2.80.0070.0369.14
5.2.70.0070.0339.14
5.2.60.0050.0439.10
5.2.50.0110.0449.07
5.2.40.0060.0309.05
5.2.30.0050.0309.02
5.2.20.0050.0309.00
5.2.10.0020.0338.93
5.2.00.0070.0318.79
5.1.60.0020.0298.08
5.1.50.0020.0298.07
5.1.40.0070.0228.05
5.1.30.0070.0258.40
5.1.20.0030.0288.43
5.1.10.0040.0278.15
5.1.00.0040.0278.15
5.0.50.0050.0196.64
5.0.40.0030.0226.50
5.0.30.0060.0476.31
5.0.20.0120.0276.28
5.0.10.0080.0276.26
5.0.00.0060.0366.25
4.4.90.0040.0214.78
4.4.80.0080.0164.75
4.4.70.0160.0534.75
4.4.60.0040.0204.76
4.4.50.0040.0204.77
4.4.40.0110.0364.71
4.4.30.0030.0234.76
4.4.20.0050.0514.84
4.4.10.0010.0194.85
4.4.00.0020.0304.75
4.3.110.0050.0174.67
4.3.100.0030.0164.67
4.3.90.0050.0254.64
4.3.80.0120.0294.59
4.3.70.0130.0334.63
4.3.60.0050.0184.63
4.3.50.0040.0454.63
4.3.40.0060.0244.54
4.3.30.0020.0183.29
4.3.20.0040.0203.27
4.3.10.0010.0173.23
4.3.00.0030.0237.14

preferences:
140.39 ms | 1394 KiB | 7 Q