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)
5.4.240.0050.03612.42
5.4.230.0090.03512.41
5.4.220.0060.04112.41
5.4.210.0040.03812.41
5.4.200.0060.03812.41
5.4.190.0040.03812.41
5.4.180.0040.03712.41
5.4.170.0040.03812.42
5.4.160.0050.03612.41
5.4.150.0070.03512.41
5.4.140.0040.03812.10
5.4.130.0040.03712.08
5.4.120.0050.03812.04
5.4.110.0040.03612.04
5.4.100.0050.03512.04
5.4.90.0070.03612.04
5.4.80.0070.03912.04
5.4.70.0050.03512.04
5.4.60.0070.03312.04
5.4.50.0040.03612.04
5.4.40.0060.03812.02
5.4.30.0070.03912.02
5.4.20.0060.03512.02
5.4.10.0080.03212.02
5.4.00.0050.03611.51
5.3.280.0050.04212.72
5.3.270.0070.03812.73
5.3.260.0080.03812.73
5.3.250.0050.04012.73
5.3.240.0090.03612.73
5.3.230.0050.04012.72
5.3.220.0110.03412.69
5.3.210.0090.03912.69
5.3.200.0070.03812.69
5.3.190.0070.03912.69
5.3.180.0060.03712.68
5.3.170.0060.03712.68
5.3.160.0050.03612.68
5.3.150.0050.04312.69
5.3.140.0050.03812.67
5.3.130.0080.03712.67
5.3.120.0070.04412.67
5.3.110.0050.03912.67
5.3.100.0070.03512.14
5.3.90.0050.03912.12
5.3.80.0050.03612.11
5.3.70.0070.03812.11
5.3.60.0040.03812.09
5.3.50.0070.03512.04
5.3.40.0050.04012.04
5.3.30.0070.03612.01
5.3.20.0080.03511.79
5.3.10.0050.03711.75
5.3.00.0050.03911.74

preferences:
139.55 ms | 1394 KiB | 7 Q