3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Install this pear extention on linux by doing: $ pear channel-discover phpquery-pear.appspot.com $ pear install phpquery/phpQuery */ require('phpQuery.php'); /** * Gets the server that a player has joined * @param string $username The username of the player * @return array An array that consists of: success, title, url and errorCode */ $username = "SoL0vex" ; function getJoinedServer ($username) { $curl = curl_init("http://battlelog.battlefield.com/bf3/user/$username"); curl_setopt($curl, CURLOPT_FAILONERROR, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_ENCODING, 'gzip'); curl_setopt($curl, CURLOPT_TIMEOUT, 30); $doc = phpQuery::newDocument(curl_exec($curl)); phpQuery::selectDocument($doc); $li = pq('.common-playing-link a'); if (pq($li)->attr('href')) { return array('success' => true, 'title' => pq($li)->attr('title'), 'url' => 'http://battlelog.battlefield.com' . pq($li)->attr('href')); } else { return array('success' => false, 'errorCode' => 1); } curl_close($curl); } // Measure time $mtime = microtime(); $mtime = explode(' ',$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; // Get joined server $result = getJoinedServer((isset($_GET['user']) ? $_GET['user'] : 'diegorod')); if($result['success']) { echo "<a href='${result['url']}'>${result['title']}</a>"; } elseif ($result['errorCode'] === 1) { echo 'User not playing'; } // Stop measuring time $mtime = microtime(); $mtime = explode(' ',$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); // Output execution time echo '<br>This page was created in '.$totaltime.' seconds'; ?>

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.10.0110.00715.71
7.4.00.0070.01215.64
7.3.130.0120.00615.56
7.3.120.0050.01015.43
7.3.110.0050.01115.60
7.3.100.0050.01115.72
7.3.90.0060.00715.44
7.3.80.0070.00715.66
7.3.70.0050.00715.49
7.3.60.0050.01015.50
7.3.50.0060.00715.56
7.3.40.0060.00815.59
7.3.30.0080.00515.51
7.3.20.0090.00317.42
7.3.10.0100.00617.09
7.3.00.0050.00816.95
7.2.260.0050.01115.63
7.2.250.0060.01315.58
7.2.240.0030.01215.71
7.2.230.0100.00615.94
7.2.220.0030.01315.80
7.2.210.0060.00515.71
7.2.200.0000.01215.80
7.2.190.0080.00715.89
7.2.180.0040.00615.61
7.2.170.0050.01015.82
7.2.160.0050.01215.77
7.2.150.0030.00817.50
7.2.140.0060.00617.50
7.2.130.0080.00717.14
7.2.120.0080.00817.03
7.2.110.0070.00817.21
7.2.100.0040.01317.10
7.2.90.0050.01017.12
7.2.80.0120.00517.10
7.2.70.0060.01017.21
7.2.60.0070.00817.22
7.2.50.0080.00917.09
7.2.40.0100.00417.23
7.2.30.0010.01217.09
7.2.20.0090.00617.22
7.2.10.0090.00617.19
7.2.00.0090.00517.78
7.1.330.0020.01416.44
7.1.320.0040.00816.37
7.1.310.0080.00616.46
7.1.300.0060.00716.35
7.1.290.0030.00816.57
7.1.280.0020.01216.33
7.1.270.0000.01116.55
7.1.260.0030.00616.45
7.1.250.0060.00916.12
7.1.240.0050.01016.63
7.1.230.0060.00616.45
7.1.220.0030.01116.41
7.1.210.0060.01016.43
7.1.200.0030.01016.35
7.1.190.0030.00916.31
7.1.180.0040.01116.34
7.1.170.0100.00716.47
7.1.160.0070.00516.35
7.1.150.0040.01116.43
7.1.140.0080.00616.43
7.1.130.0050.00916.35
7.1.120.0060.00916.47
7.1.110.0070.00716.44
7.1.100.0040.00817.08
7.1.90.0020.01316.56
7.1.80.0050.00816.47
7.1.70.0030.01316.73
7.1.60.0080.00817.74
7.1.50.0100.00516.41
7.1.40.0050.00916.51
7.1.30.0060.00616.57
7.1.20.0040.01116.41
7.1.10.0070.00616.21
7.1.00.0060.02918.47
7.0.330.0100.00415.95
7.0.320.0080.00716.11
7.0.310.0030.01215.97
7.0.300.0070.00716.10
7.0.290.0080.00716.02
7.0.280.0070.00516.15
7.0.270.0060.00716.05
7.0.260.0060.00816.06
7.0.250.0050.01016.09
7.0.240.0070.00916.22
7.0.230.0050.00615.97
7.0.220.0080.00616.08
7.0.210.0040.00916.08
7.0.200.0270.00515.76
7.0.190.0090.00516.06
7.0.180.0030.01015.91
7.0.170.0080.00516.02
7.0.160.0040.00716.13
7.0.150.0030.00816.08
7.0.140.0100.00416.17
7.0.130.0110.00216.03
7.0.120.0080.00516.18
7.0.110.0080.00816.12
7.0.100.0050.00716.17
7.0.90.0050.00716.11
7.0.80.0080.00516.03
7.0.70.0080.00616.10
7.0.60.0110.03017.91
7.0.50.0070.02517.51
7.0.40.0040.02716.13
7.0.30.0110.02116.12
7.0.20.0080.02816.06
7.0.10.0040.02816.06
7.0.00.0090.02616.13
5.6.400.0040.00914.81
5.6.390.0080.00615.10
5.6.380.0070.00915.17
5.6.370.0070.00715.09
5.6.360.0060.00414.97
5.6.350.0060.00914.94
5.6.340.0050.00915.01
5.6.330.0050.00615.04
5.6.320.0030.01014.77
5.6.310.0050.00814.96
5.6.300.0030.01115.03
5.6.290.0050.01014.88
5.6.280.0080.02717.05
5.6.270.0070.00715.00
5.6.260.0030.00814.92
5.6.250.0070.00514.96
5.6.240.0100.00315.05
5.6.230.0030.00815.05
5.6.220.0090.00915.15
5.6.210.0090.03216.74
5.6.200.0060.03316.11
5.6.190.0080.02317.05
5.6.180.0090.02116.99
5.6.170.0110.02917.11
5.6.160.0070.02517.02
5.6.150.0160.01917.09
5.6.140.0040.03017.03
5.6.130.0110.02216.97
5.6.120.0120.02116.98
5.6.110.0150.02017.03
5.6.100.0170.02116.97
5.6.90.0140.02616.88
5.6.80.0120.02116.87
5.6.70.0170.02016.69
5.6.60.0130.02116.70
5.6.50.0160.01816.84
5.6.40.0120.02316.78
5.6.30.0120.02116.66
5.6.20.0110.02016.76
5.6.10.0100.02516.66
5.6.00.0050.02716.70
5.5.380.0090.00514.67
5.5.370.0050.00814.96
5.5.360.0050.01114.94
5.5.350.1420.02216.65
5.5.340.0050.01915.90
5.5.330.0140.01916.79
5.5.320.0100.02316.87
5.5.310.0070.02416.84
5.5.300.0120.02116.79
5.5.290.0050.02916.81
5.5.280.0130.02016.88
5.5.270.0120.02316.83
5.5.260.0110.02716.89
5.5.250.0120.02116.91
5.5.240.0060.02416.55
5.5.230.0120.02416.62
5.5.220.0140.02016.58
5.5.210.0160.02016.54
5.5.200.0060.02916.53
5.5.190.0050.02716.67
5.5.180.0170.01616.59
5.5.170.0090.00614.75
5.5.160.0110.02616.61
5.5.150.0060.02716.64
5.5.140.0100.02216.56
5.5.130.0110.02316.47
5.5.120.0130.02516.63
5.5.110.0090.02316.56
5.5.100.0050.02916.59
5.5.90.0090.02316.63
5.5.80.0080.02416.52
5.5.70.0070.02716.42
5.5.60.0060.02416.60
5.5.50.0130.02616.55
5.5.40.0140.01816.51
5.5.30.0100.02316.63
5.5.20.0110.02216.52
5.5.10.0110.02216.56
5.5.00.0110.02016.67

preferences:
41.4 ms | 401 KiB | 5 Q