3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once '//185.28.21.62/home/u599693672/public_html/inc/phpinfo.php/config.php'; define("BF3APIIdent", 'R8tyRf7J5O'); define("BF3APIKey", 'UvVGtyTwb1BlT7nA2dzFT8fKIdUgeksg'); // Platform can be pc, 360, ps3 $platform = 'pc'; $memberObj = new \app\classes\Members(); $queryParam = array( 'WHERE' => "WHERE (usertype_tbusers<>'N')", 'ORDER' => 'ORDER BY lastupdate_tbusers ASC', 'LIMIT' => 'LIMIT ' . 20 ); $results = $memberObj->getAllbyCriteria($queryParam); $tempData = array('players' => array(), 'opt' => array()); foreach ($results as $newsEntry): $bf3Stats = updatePlayer($platform, $newsEntry->userid_tbusers); if ($bf3Stats['status'] == "exists"): $bf3Stats = lookupPlayer($platform, $newsEntry->userid_tbusers); if ($bf3Stats['status'] == "exists"): if ($bf3Stats['task'][result] == "found"): $tempData['players'][] = $newsEntry->userid_tbusers; endif; endif; endif; endforeach; $bf3Stats = getPlayersBF3Info($tempData); unset($bf3Stats['failed']); // to make sure that non finded players won´t get into it. $varPlayerPosition = 0; foreach ($bf3Stats['list'] as $userEntry): if (isset($userEntry)): $varKills = $userEntry['stats']['global']['kills']; $varDeaths = $userEntry['stats']['global']['deaths']; $varSkill = $userEntry['stats']['global']['elo']; $varlastUpdate = $userEntry['date_update']; $varRatio = round(($varKills / $varDeaths), 2); else: $varRatio = 0; $varSkill = 0; $varlastUpdate = time() - 86400; endif; $memberFound = $memberObj->getDataByID($tempData['players'][$varPlayerPosition]); if (count($memberFound) > 0): $tempAttributes = array( 'skill_tbusers' => $varSkill, 'ratio_tbusers' => $varRatio, 'lastupdate_tbusers' => date('Y-m-d H:i:s', $varlastUpdate) ); $memberFound->updateTo($tempAttributes); endif; $varPlayerPosition += 1; endforeach; //=========================== End of script ==================================================================== function setupClientKey($clientident = null, $name = null) { $data = array(); $data['ident'] = BF3APIIdent; $data['time'] = time(); $data['clientident'] = $clientident; $data['name'] = $name; return getAPIDataSigned('setupkey', 'global', $data); } function getClientKey($clientident) { $data = array(); $data['ident'] = BF3APIIdent; $data['time'] = time(); $data['clientident'] = $clientident; return getAPIDataSigned('getkey', 'global', $data); } function lookupPlayer($platform, $name) { echo BF3APIIdent; $data = array(); $data['ident'] = BF3APIIdent; $data['time'] = time(); $data['player'] = $name; return getAPIDataSigned('playerlookup', $platform, $data); } function updatePlayer($platform, $name) { $data = array(); $data['ident'] = BF3APIIdent; $data['time'] = time(); $data['player'] = $name; return getAPIDataSigned('playerupdate', $platform, $data); } function getAPIDataSigned($type, $platform, $data) { // Convert data to JSON $urlbase64 = array('+' => '-', '/' => '_', '=' => ''); $data = strtr(base64_encode(json_encode($data)), $urlbase64); $postdata = array(); $postdata['data'] = $data; $postdata['sig'] = strtr(base64_encode(hash_hmac('sha256', $data, BF3APIKey, true)), $urlbase64); // Run POST Request via CURL $c = curl_init('http://api.bf3stats.com/' . $platform . '/' . $type . '/'); curl_setopt($c, CURLOPT_HEADER, false); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_USERAGENT, 'BF3StatsAPI/0.1'); curl_setopt($c, CURLOPT_HTTPHEADER, array('Expect:')); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_POSTFIELDS, $postdata); $data = curl_exec($c); $statuscode = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); if ($statuscode == 200) { // Decode JSON Data $data = json_decode($data, true); return $data; } else { echo "BF3 Stats API error status: " . $statuscode; return false; } } function getPlayersBF3Info($data) { // List of options $data['opt']['clear'] = true; $data['opt']['global'] = true; $data['time'] = time(); // Platform can be pc, 360, ps3 $platform = 'pc'; // Convert lists to JSON $postdata = array(); $postdata['players'] = json_encode($data['players']); $postdata['opt'] = json_encode($data['opt']); // Run POST Request via CURL $c = curl_init('http://api.bf3stats.com/' . $platform . '/playerlist/'); curl_setopt($c, CURLOPT_HEADER, false); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_USERAGENT, 'BF3StatsAPI/0.1'); curl_setopt($c, CURLOPT_HTTPHEADER, array('Expect:')); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_POSTFIELDS, $postdata); $data = curl_exec($c); $statuscode = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); if ($statuscode == 200) { // Decode JSON Data $data = json_decode($data, true); // Print data for debugging return $data; // ... now you use $data to do whatever } else { return "ERROR"; } } ?>

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.3.10.0070.01016.66
7.3.00.0050.00816.51
7.2.130.0050.00716.73
7.2.120.0050.00616.58
7.2.110.0080.00716.77
7.2.100.0060.00916.55
7.2.90.0080.00516.65
7.2.80.0030.00916.41
7.2.70.0090.00616.76
7.2.60.0050.01016.53
7.2.50.0050.01316.57
7.2.40.0080.00716.62
7.2.30.0080.00816.70
7.2.20.0070.00916.73
7.2.10.0110.01116.79
7.2.00.0020.01316.55
7.1.250.0040.00515.52
7.1.240.0030.00915.71
7.1.230.0040.01115.43
7.1.220.0070.00415.62
7.1.210.0030.00715.64
7.1.200.0080.00515.52
7.1.190.0000.01115.38
7.1.180.0060.00315.40
7.1.170.0110.00415.51
7.1.160.0060.00615.61
7.1.150.0040.01115.64
7.1.140.0040.00815.79
7.1.130.0060.00615.53
7.1.120.0030.00615.63
7.1.110.0000.01015.34
7.1.100.0020.00916.72
7.1.90.0060.00615.64
7.1.80.0110.00415.61
7.1.70.0090.00216.10
7.1.60.0030.01317.68
7.1.50.0050.01016.16
7.1.40.0000.01015.49
7.1.30.0030.01015.34
7.1.20.0030.00915.59
7.1.10.0000.01315.61
7.1.00.0070.03818.89
7.0.330.0030.00614.87
7.0.320.0030.01014.97
7.0.310.0130.00015.21
7.0.300.0040.01114.81
7.0.290.0000.00815.24
7.0.280.0000.01415.18
7.0.270.0080.00315.23
7.0.260.0030.01015.12
7.0.250.0030.01015.27
7.0.240.0090.00615.25
7.0.230.0060.00615.21
7.0.220.0030.00715.39
7.0.210.0030.00614.84
7.0.200.0040.00715.96
7.0.190.0060.00615.22
7.0.180.0050.00515.18
7.0.170.0060.00315.06
7.0.160.0030.00915.23
7.0.150.0000.01415.19
7.0.140.0030.04018.45
7.0.130.0030.00915.15
7.0.120.0100.00315.22
7.0.110.0000.00715.04
7.0.100.0050.03817.63
7.0.90.0220.04517.47
7.0.80.0220.02517.49
7.0.70.0180.03817.50
7.0.60.0200.03217.68
7.0.50.0210.04517.68
7.0.40.0020.04416.67
7.0.30.0030.04816.55
7.0.20.0070.04516.52
7.0.10.0030.04716.71
7.0.00.0050.04216.62
5.6.380.0040.01214.06
5.6.370.0040.01113.69
5.6.360.0060.00314.42
5.6.350.0000.01514.36
5.6.340.0000.00914.22
5.6.330.0070.00713.91
5.6.320.0000.01413.94
5.6.310.0030.00914.22
5.6.300.0070.00713.78
5.6.290.0030.00714.25
5.6.280.0080.03617.67
5.6.270.0080.00314.11
5.6.260.0070.00714.27
5.6.250.0090.04217.42
5.6.240.0080.04317.35
5.6.230.0020.04917.46
5.6.220.0040.04517.46
5.6.210.0070.02517.36
5.6.200.0060.04617.66
5.6.190.0010.02817.61
5.6.180.0060.04517.49
5.6.170.0050.04617.66
5.6.160.0070.04117.53
5.6.150.0090.04317.67
5.6.140.0040.03917.48
5.6.130.0080.02817.54
5.6.120.0070.05017.56
5.6.110.0030.04817.63
5.6.100.0070.04417.62
5.6.90.0030.04917.46
5.6.80.0050.02817.43
5.6.70.0080.02517.28
5.6.60.0070.04217.24
5.6.50.0050.02717.41
5.6.40.0110.01917.30
5.6.30.0050.04117.34
5.6.20.0070.02517.25
5.6.10.0080.04017.26
5.6.00.0100.03917.11
5.5.380.0050.04115.78
5.5.370.0080.02015.70
5.5.360.0040.03115.72
5.5.350.0100.03815.56
5.5.340.0080.04015.94
5.5.330.0150.03215.99
5.5.320.0010.03615.90
5.5.310.0100.03915.74
5.5.300.0070.04315.75
5.5.290.0070.04215.75
5.5.280.0120.04115.72
5.5.270.0090.02715.96
5.5.260.0030.02715.86
5.5.250.0070.04315.69
5.5.240.0050.04015.58
5.5.230.0070.03815.45
5.5.220.0030.03815.41
5.5.210.0050.04215.34
5.5.200.0020.03215.58
5.5.190.0090.04015.40
5.5.180.0050.03515.58
5.5.170.0030.00610.63
5.5.160.0080.03815.48
5.5.150.0030.02815.32
5.5.140.0060.04315.51
5.5.130.0020.05015.60
5.5.120.0050.02515.57
5.5.110.0100.03915.55
5.5.100.0060.03815.53
5.5.90.0120.03215.51
5.5.80.0110.03515.34
5.5.70.0120.02715.49
5.5.60.0030.03715.45
5.5.50.0060.03615.55
5.5.40.0050.04015.34
5.5.30.0000.04915.60
5.5.20.0060.03015.49
5.5.10.0040.03315.42
5.5.00.0030.03815.49
5.4.450.0060.04015.05
5.4.440.0050.03214.90
5.4.430.0030.04715.03
5.4.420.0050.03715.04
5.4.410.0060.03815.19
5.4.400.0040.04314.94
5.4.390.0050.03814.76
5.4.380.0050.03414.74
5.4.370.0050.04214.99
5.4.360.0000.02614.98
5.4.350.0050.03615.06
5.4.340.0100.03414.99
5.4.330.0030.00310.65
5.4.320.0090.03514.98
5.4.310.0030.04315.09
5.4.300.0070.04014.95
5.4.290.0050.02514.92
5.4.280.0080.02415.04
5.4.270.0020.03415.03
5.4.260.0080.03615.00
5.4.250.0050.03514.69
5.4.240.0030.02514.76
5.4.230.0050.04214.99
5.4.220.0070.04414.80
5.4.210.0050.03014.97
5.4.200.0030.04114.78
5.4.190.0050.02314.95
5.4.180.0050.04214.90
5.4.170.0070.03514.96
5.4.160.0100.02014.93
5.4.150.0000.02714.97
5.4.140.0100.03813.49
5.4.130.0060.02313.63
5.4.120.0020.02413.50
5.4.110.0080.02213.60
5.4.100.0060.04113.64
5.4.90.0070.02313.65
5.4.80.0050.03813.75
5.4.70.0100.03213.64
5.4.60.0080.01813.69
5.4.50.0030.04013.66
5.4.40.0060.03813.55
5.4.30.0000.02913.61
5.4.20.0090.01413.46
5.4.10.0050.02113.74
5.4.00.0020.04113.15
5.3.290.0050.03012.66
5.3.280.0100.03312.53
5.3.270.0040.02512.62
5.3.260.0070.03312.66
5.3.250.0060.03812.61
5.3.240.0070.03812.56
5.3.230.0020.03012.56
5.3.220.0090.03612.48
5.3.210.0050.02312.37
5.3.200.0020.04212.48
5.3.190.0050.04012.51
5.3.180.0050.04112.64
5.3.170.0070.02512.57
5.3.160.0050.03912.56
5.3.150.0080.03512.64
5.3.140.0030.04012.49
5.3.130.0060.03512.41
5.3.120.0050.02812.63
5.3.110.0090.04012.60
5.3.100.0050.03812.33
5.3.90.0050.03712.38
5.3.80.0050.03312.14
5.3.70.0030.03512.30
5.3.60.0090.03312.21
5.3.50.0100.03212.30
5.3.40.0080.04012.21
5.3.30.0050.03612.10
5.3.20.0070.02212.13
5.3.10.0030.04312.07
5.3.00.0020.02511.92

preferences:
40.35 ms | 401 KiB | 5 Q