3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once 'Services/Soundcloud.php'; /* * function to get via cUrl * From lastRSS 0.9.1 by Vojtech Semecky, webmaster @ webdot . cz * See http://lastrss.webdot.cz/ */ function curlGet($URL) { $ch = curl_init(); $timeout = 3; curl_setopt( $ch , CURLOPT_URL , $URL ); curl_setopt( $ch , CURLOPT_RETURNTRANSFER , 1 ); curl_setopt( $ch , CURLOPT_CONNECTTIMEOUT , $timeout ); /* if you want to force to ipv6, uncomment the following line */ //curl_setopt( $ch , CURLOPT_IPRESOLVE , 'CURLOPT_IPRESOLVE_V6'); $tmp = curl_exec( $ch ); curl_close( $ch ); return $tmp; } /* * function to use cUrl to get the headers of the file */ function get_location($url) { $my_ch = curl_init(); curl_setopt($my_ch, CURLOPT_URL,$url); curl_setopt($my_ch, CURLOPT_HEADER, true); curl_setopt($my_ch, CURLOPT_NOBODY, true); curl_setopt($my_ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($my_ch, CURLOPT_TIMEOUT, 10); $r = curl_exec($my_ch); foreach(explode("\n", $r) as $header) { if(strpos($header, 'Location: ') === 0) { return trim(substr($header,10)); } } return ''; } function get_size($url) { $my_ch = curl_init(); curl_setopt($my_ch, CURLOPT_URL,$url); curl_setopt($my_ch, CURLOPT_HEADER, true); curl_setopt($my_ch, CURLOPT_NOBODY, true); curl_setopt($my_ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($my_ch, CURLOPT_TIMEOUT, 10); $r = curl_exec($my_ch); foreach(explode("\n", $r) as $header) { if(strpos($header, 'Content-Length:') === 0) { return trim(substr($header,16)); } } return ''; } function get_description($url) { $fullpage = curlGet($url); $dom = new DOMDocument(); @$dom->loadHTML($fullpage); $xpath = new DOMXPath($dom); $tags = $xpath->query('//div[@class="info-description-body"]'); foreach ($tags as $tag) { $my_description .= (trim($tag->nodeValue)); } return utf8_decode($my_description); } // create a client object with your app credentials $client = new Services_Soundcloud( '6813c5d125013568ef986b73e4ba265c', '2eb6f212de6f4963c3873f8afdf517e9'); // a permalink to a track $track_url = 'http://soundcloud.com/forss/voca-nomen-tuum'; if($_GET['url']){ $track_url = $_GET['url']; } $url='http://api.soundcloud.com/resolve.json?url='.$track_url.'&client_id=6813c5d125013568ef986b73e4ba265c'; $headers=get_headers($url,1); $location=$headers['Location']; // resolve track URL into track resource //$track = json_decode($client->get('resolve', array('url' => $track_url))); /* now that we have the track id, we can get a list of comments, for example foreach (json_decode($client->get('tracks/' . $track->id . 'comments')) as $c) print 'Someone said: ' . $c->body . ' at ' . $c->timestamp . "\n"; try { $track = $soundcloud->download($track->id); } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) { exit($e->getMessage()); } file_put_contents("files/download.mp3",$track); echo "<a href='files/download.mp3'>download</a>";*/ echo $location; function modify_url($mod, $url = FALSE){ // If $url wasn't passed in, use the current url if($url == FALSE){ $scheme = $_SERVER['SERVER_PORT'] == 80 ? 'http' : 'https'; $url = $scheme.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; } // Parse the url into pieces $url_array = parse_url($url); // The original URL had a query string, modify it. if(!empty($url_array['query'])){ parse_str($url_array['query'], $query_array); foreach ($mod as $key => $value) { if(!empty($query_array[$key])){ $query_array[$key] = $value; } } } // The original URL didn't have a query string, add it. else{ $query_array = $mod; } return $url_array['scheme'].'://'.$url_array['host'].'/'.$url_array['path'].'?'.http_build_query($query_array); } $location = modify_url(array('client_id' => '6813c5d125013568ef986b73e4ba265c'), $location); $json = file_get_contents($location); $obj = json_decode($json); echo $obj->id; ?>

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.40.0040.01118.97
8.3.30.0070.00720.17
8.3.20.0080.00020.23
8.3.10.0040.00421.84
8.3.00.0060.00322.40
8.2.170.0210.00022.96
8.2.160.0040.01121.94
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0090.00626.16
8.2.120.0050.00320.87
8.2.110.0170.00322.10
8.2.100.0080.00418.16
8.2.90.0000.00819.42
8.2.80.0040.00419.52
8.2.70.0060.00317.75
8.2.60.0090.00017.87
8.2.50.0030.00618.07
8.2.40.0040.00418.21
8.2.30.0040.00419.47
8.2.20.0000.00817.88
8.2.10.0030.00517.80
8.2.00.0000.00817.84
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00723.91
8.1.230.0110.00019.16
8.1.220.0000.00817.77
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0040.00417.53
8.1.180.0040.00419.01
8.1.170.0060.00318.66
8.1.160.0030.00618.91
8.1.150.0030.00618.67
8.1.140.0050.00317.36
8.1.130.0080.00017.92
8.1.120.0000.00717.50
8.1.110.0000.00817.50
8.1.100.0000.00817.52
8.1.90.0040.00417.52
8.1.80.0050.00317.55
8.1.70.0040.00417.44
8.1.60.0000.00817.57
8.1.50.0030.00517.49
8.1.40.0000.00817.57
8.1.30.0000.00917.73
8.1.20.0040.00417.71
8.1.10.0080.00017.57
8.1.00.0070.00317.58
8.0.300.0030.00618.77
8.0.290.0060.00317.43
8.0.280.0040.00418.51
8.0.270.0040.00317.41
8.0.260.0070.00017.05
8.0.250.0000.00817.11
8.0.240.0080.00017.23
8.0.230.0000.00717.07
8.0.220.0000.00717.09
8.0.210.0000.00817.04
8.0.200.0000.00717.13
8.0.190.0050.00317.23
8.0.180.0040.00417.19
8.0.170.0000.00917.13
8.0.160.0070.00017.17
8.0.150.0030.00516.96
8.0.140.0000.00817.13
8.0.130.0030.00313.52
8.0.120.0000.00817.07
8.0.110.0000.00817.15
8.0.100.0000.00717.22
8.0.90.0000.00717.07
8.0.80.0040.01117.03
8.0.70.0040.00417.00
8.0.60.0000.00817.22
8.0.50.0040.00417.12
8.0.30.0140.00817.23
8.0.20.0060.01417.40
8.0.10.0000.00817.07
8.0.00.0080.01216.75
7.4.330.0000.00615.00
7.4.320.0070.00016.78
7.4.300.0080.00016.70
7.4.290.0070.00016.55
7.4.280.0040.00416.60
7.4.270.0000.00716.60
7.4.260.0030.00313.36
7.4.250.0000.00816.59
7.4.240.0040.00316.58
7.4.230.0000.00716.67
7.4.220.0060.01216.66
7.4.210.0050.01116.73
7.4.200.0040.00416.46
7.4.190.0040.00416.66
7.4.160.0060.01216.56
7.4.150.0110.00717.40
7.4.140.0110.00717.86
7.4.130.0100.01016.64
7.4.120.0090.00916.51
7.4.110.0090.00916.58
7.4.100.0110.00816.63
7.4.90.0130.00616.57
7.4.80.0070.01119.39
7.4.70.0100.00716.62
7.4.60.0170.00016.34
7.4.50.0080.00016.27
7.4.40.0100.00622.77
7.4.30.0150.00316.41
7.4.00.0030.01415.00
7.3.330.0000.00513.35
7.3.320.0000.00513.34
7.3.310.0050.00216.43
7.3.300.0000.00716.23
7.3.290.0110.00816.34
7.3.280.0100.00716.36
7.3.270.0070.01417.40
7.3.260.0120.00616.45
7.3.250.0090.01316.41
7.3.240.0140.01116.58
7.3.230.0180.00616.46
7.3.210.0100.00716.28
7.3.200.0060.01519.39
7.3.190.0100.00716.43
7.3.180.0140.00716.35
7.3.170.0100.01016.52
7.3.160.0060.01216.33
7.3.120.0110.00414.98
7.2.330.0110.01416.68
7.2.320.0200.01616.39
7.2.310.0140.00316.79
7.2.300.0080.00816.37
7.2.290.0040.01516.61
7.2.00.0090.00319.33
7.1.100.0100.00718.05
7.1.70.0050.00516.72
7.1.60.0130.01019.32
7.1.50.0070.01516.51
7.1.00.0030.03322.41
7.0.200.0820.00714.13
7.0.140.0000.07721.93
7.0.100.0270.08019.93
7.0.90.0170.07720.18
7.0.80.0170.03019.89
7.0.70.0100.08720.16
7.0.60.0100.04719.89
7.0.50.0030.04020.33
7.0.40.0070.08320.12
7.0.30.0170.07720.16
7.0.20.0100.07319.93
7.0.10.0070.07720.01
7.0.00.0030.08020.05
5.6.280.0030.07321.09
5.6.250.0070.07320.61
5.6.240.0070.07320.66
5.6.230.0070.04020.65
5.6.220.0070.06020.68
5.6.210.0070.07720.67
5.6.200.0070.09021.05
5.6.190.0030.06321.14
5.6.180.0100.06021.07
5.6.170.0070.08021.05
5.6.160.0000.07321.10
5.6.150.0070.06721.02
5.6.140.0070.04320.96
5.6.130.0100.05721.11
5.6.120.0200.06321.14
5.6.110.0030.05321.16
5.6.100.0130.08720.93
5.6.90.0070.08321.09
5.6.80.0130.07020.44
5.6.70.0030.05020.47
5.6.60.0000.08020.46
5.6.50.0100.08020.43
5.6.40.0030.07720.41
5.6.30.0070.06320.34
5.6.20.0070.08020.35
5.6.10.0070.04720.40
5.6.00.0030.09020.52
5.5.380.0100.03720.36
5.5.370.0070.08020.37
5.5.360.0100.07320.39
5.5.350.0000.04320.45
5.5.340.0100.07720.74
5.5.330.0100.07320.88
5.5.320.0200.07020.79
5.5.310.0170.06020.77
5.5.300.0070.05720.88
5.5.290.0070.08320.91
5.5.280.0030.04320.77
5.5.270.0070.05320.86
5.5.260.0100.06720.92
5.5.250.0070.08020.64
5.5.240.0030.05020.00
5.5.230.0030.08320.28
5.5.220.0030.05720.01
5.5.210.0070.04720.25
5.5.200.0130.06020.25
5.5.190.0000.05020.09
5.5.180.0030.09720.23
5.5.160.0070.08020.19
5.5.150.0130.04020.20
5.5.140.0070.06720.08
5.5.130.0070.07720.23
5.5.120.0030.05020.28
5.5.110.0030.08020.27
5.5.100.0070.07320.18
5.5.90.0070.06720.13
5.5.80.0200.06720.13
5.5.70.0100.07320.00
5.5.60.0100.06320.11
5.5.50.0030.08720.04
5.5.40.0030.05720.06
5.5.30.0200.05720.03
5.5.20.0130.07020.09
5.5.10.0070.07320.11
5.5.00.0030.08719.98
5.4.450.0100.07719.50
5.4.440.0000.05019.37
5.4.430.0100.06019.54
5.4.420.0000.04719.35
5.4.410.0100.04719.08
5.4.400.0070.04019.10
5.4.390.0100.06019.04
5.4.380.0070.03719.14
5.4.370.0070.04019.16
5.4.360.0100.07319.18
5.4.350.0070.04319.04
5.4.340.0130.06319.17
5.4.320.0030.05018.90
5.4.310.0130.06319.09
5.4.300.0070.07019.05
5.4.290.0070.04718.95
5.4.280.0070.05719.14
5.4.270.0030.06719.14
5.4.260.0130.04018.95
5.4.250.0130.06718.84
5.4.240.0070.03719.05
5.4.230.0170.06719.03
5.4.220.0200.04319.13
5.4.210.0230.03019.02
5.4.200.0100.05019.13
5.4.190.0100.05319.20
5.4.180.0100.04019.23
5.4.170.0070.04019.12
5.4.160.0070.04018.89
5.4.150.0000.04719.04
5.4.140.0000.07316.47
5.4.130.0100.06316.47
5.4.120.0030.05716.48
5.4.110.0070.07316.55
5.4.100.0130.03716.33
5.4.90.0100.06316.57
5.4.80.0100.04716.45
5.4.70.0070.05716.45
5.4.60.0170.06316.48
5.4.50.0100.06016.35
5.4.40.0070.06016.43
5.4.30.0070.04016.37
5.4.20.0070.06716.42
5.4.10.0100.07316.27
5.4.00.0000.06715.87
5.3.290.0130.07015.54
5.3.280.0100.03715.54
5.3.270.0030.04315.54
5.3.260.0030.07015.54
5.3.250.0030.04715.54
5.3.240.0030.03715.54
5.3.230.0070.04315.54
5.3.220.0030.07015.54
5.3.210.0100.05015.54
5.3.200.0030.03715.54
5.3.190.0070.06315.54
5.3.180.0030.04315.54
5.3.170.0100.06715.54
5.3.160.0100.07315.54
5.3.150.0030.08015.54
5.3.140.0100.07715.54
5.3.130.0130.06715.54
5.3.120.0100.04715.54
5.3.110.0100.07015.54
5.3.100.0030.03715.54
5.3.90.0100.04315.54
5.3.80.0030.03715.54
5.3.70.0030.03715.54
5.3.60.0100.04715.54
5.3.50.0070.03015.54
5.3.40.0030.03715.54
5.3.30.0030.03715.54
5.3.20.0000.03015.54
5.3.10.0030.02715.54
5.3.00.0000.03015.54
5.2.170.0000.03015.54
5.2.160.0070.02315.54
5.2.150.0070.02715.54
5.2.140.0070.02715.54
5.2.130.0030.03315.54
5.2.120.0070.03015.54
5.2.110.0000.03315.54
5.2.100.0030.02715.54
5.2.90.0030.02315.54
5.2.80.0000.02715.54
5.2.70.0070.02315.54
5.2.60.0070.02315.54
5.2.50.0030.02315.54
5.2.40.0030.02315.54
5.2.30.0030.02315.54
5.2.20.0030.02315.54
5.2.10.0000.02715.54
5.2.00.0030.02715.54
5.1.60.0030.02015.54
5.1.50.0000.02315.54
5.1.40.0000.02315.54
5.1.30.0000.02315.54
5.1.20.0030.02315.54
5.1.10.0000.02315.54
5.1.00.0000.02715.54
5.0.50.0000.01715.54
5.0.40.0000.02015.54
5.0.30.0000.02715.54
5.0.20.0000.02715.54
5.0.10.0000.01715.54
5.0.00.0000.02715.54
4.4.90.0000.01715.54
4.4.80.0030.01315.54
4.4.70.0000.01315.54
4.4.60.0030.01015.54
4.4.50.0000.01315.54
4.4.40.0000.02315.54
4.4.30.0030.01315.54
4.4.20.0030.01015.54
4.4.10.0000.01715.54
4.4.00.0000.03715.54
4.3.110.0030.01015.54
4.3.100.0000.01715.54
4.3.90.0000.01715.54
4.3.80.0000.02015.54
4.3.70.0000.01715.54
4.3.60.0070.01015.54
4.3.50.0000.01315.54
4.3.40.0000.02015.54
4.3.30.0000.01315.54
4.3.20.0000.02015.54
4.3.10.0000.01715.54
4.3.00.0000.01315.54

preferences:
50.53 ms | 400 KiB | 5 Q