3v4l.org

run code in 300+ PHP versions simultaneously
<?php $urlimdbapi='https://gdata.youtube.com/feeds/api/videos?q=Batman trailer&max-results=1&v=2.1&alt=jsonc&format=5'; $imdbapiresult=new CustomCURL($urlimdbapi, $cookie_file); $imdbresult=$imdbapiresult->send(); $imdbs_info=json_decode($imdbresult['content'], true); print_r($imdbs_info); class CustomCURL{ private $fsocket; private $header; private $method; private $postdata; private $cookie_file; public static $responseHeaders; public static $custom_curl; function __construct($url, $cookie_file){ $this->method='GET'; $this->fsocket = curl_init(); $this->setopt(CURLOPT_URL, $url); $this->setopt(CURLOPT_COOKIEFILE, realpath($cookie_file)); $this->setopt(CURLOPT_COOKIEJAR, realpath($cookie_file)); $this->setopt(CURLOPT_TIMEOUT, 0); $this->setopt(CURLOPT_RETURNTRANSFER, 1); $this->setopt(CURLOPT_MAXREDIRS, 10); $this->setopt(CURLOPT_CONNECTTIMEOUT, 30); $this->setopt(CURLOPT_FOLLOWLOCATION, 1); $this->setopt(CURLOPT_AUTOREFERER, 1); $this->setopt(CURLINFO_HEADER_OUT, 1); $this->setopt(CURLOPT_HEADER, 0); $this->setopt(CURLOPT_VERBOSE, 0); $this->setopt(CURLOPT_SSL_VERIFYPEER, 0); $this->setopt(CURLOPT_SSL_VERIFYHOST, 0); self::$responseHeaders=array(); $this->setopt(CURLOPT_HEADERFUNCTION,array('CustomCURL','headerFunction')); $this->cookie_file=$cookie_file; } static function headerFunction($ch, $header){ $vars=explode(':',$header,2); self::$responseHeaders[strtolower(trim($vars[0]))]=isset($vars[1])?trim($vars[1]):''; return strlen($header); } function setopt($opt, $value){ return curl_setopt($this->fsocket, $opt, $value); } function setHeaders($array){ return $this->header = $array; } function setPostData($array, $isMultipart = true){ $this->method='POST'; if($isMultipart){ $this->postdata = $array; }else{ $post=''; foreach($array as $key=>$val){ if(is_array($val)){ foreach($val as $subval){ if($post!=''){ $post.='&'; } $post.=urlencode($key).'='.urlencode($subval); } }else{ if($post!=''){ $post.='&'; } $post.=urlencode($key).'='.urlencode($val); } } $this->postdata = $post; } } function send($forMulti=false){ if(!empty($this->header)){ $this->setopt(CURLOPT_HTTPHEADER, $this->header); } if($this->method=='POST' && !empty($this->postdata)){ $this->setopt(CURLOPT_POST, 1); $this->setopt(CURLOPT_POSTFIELDS, $this->postdata); } if($forMulti){ return $this->fsocket; } $exec = curl_exec($this->fsocket); if(curl_errno($this->fsocket)){ $result['error'] = curl_error($this->fsocket); }else{ $result['post_data'] = $this->postdata; $result['content'] = $exec; $result['info'] = curl_getinfo($this->fsocket); $result['info']['request_headers']=curl_getinfo($this->fsocket, CURLINFO_HEADER_OUT); $result['info']['response_headers']=self::$responseHeaders; } $this->debug($result, $this->cookie_file); return $result; } function debug($result,$cookie){ /* ============================== THIS IS FOR DEBUGGING PURPOSES ============================== Comment return; to trace output */ return; echo '<h1>',$result['info']['url'],'</h1>'; echo '<h2>Content</h2>'; echo '<pre>',htmlspecialchars($result['content']),'</pre>'; echo '<h2>Cookies</h2>'; echo '<pre>',@file_get_contents($cookie),'</pre>'; echo '<h2>Post Data</h2>'; echo '<pre>'; print_r($result['post_data']); echo '</pre>'; echo '<h2>Other Info</h2>'; echo '<pre>'; print_r($result['info']); echo '</pre>'; flush(); usleep(100); } function close(){ curl_close($this->fsocket); $this->header = array(); $this->postdata = array(); } }

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.60.0120.00616.63
8.3.50.0070.00922.05
8.3.40.0040.01118.96
8.3.30.0040.01119.21
8.3.20.0040.00419.91
8.3.10.0080.00023.64
8.3.00.0030.00521.02
8.2.180.0100.01316.88
8.2.170.0140.00422.96
8.2.160.0100.00720.49
8.2.150.0060.00324.18
8.2.140.0060.00924.66
8.2.130.0060.01326.16
8.2.120.0040.00419.13
8.2.110.0100.00020.48
8.2.100.0040.00717.79
8.2.90.0000.00818.22
8.2.80.0090.00017.97
8.2.70.0030.00617.50
8.2.60.0030.00617.93
8.2.50.0040.00418.07
8.2.40.0050.00319.82
8.2.30.0040.00418.32
8.2.20.0030.00619.53
8.2.10.0000.00818.24
8.2.00.0040.00417.68
8.1.280.0070.01125.92
8.1.270.0080.00024.04
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0030.00622.21
8.1.230.0070.00420.97
8.1.220.0000.00817.77
8.1.210.0030.00518.88
8.1.200.0060.00317.48
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0040.00418.49
8.1.160.0040.00422.05
8.1.150.0030.00518.52
8.1.140.0000.00717.36
8.1.130.0070.00019.61
8.1.120.0070.00017.36
8.1.110.0000.01017.46
8.1.100.0040.00417.45
8.1.90.0050.00217.50
8.1.80.0070.00017.51
8.1.70.0030.00317.48
8.1.60.0120.00017.72
8.1.50.0030.00517.49
8.1.40.0040.00417.51
8.1.30.0030.00617.76
8.1.20.0000.00817.76
8.1.10.0040.00417.53
8.1.00.0050.00317.58
8.0.300.0040.00420.21
8.0.290.0000.00816.88
8.0.280.0000.00718.42
8.0.270.0000.00717.18
8.0.260.0060.00017.26
8.0.250.0030.00317.07
8.0.240.0000.01016.99
8.0.230.0000.00716.93
8.0.220.0000.00716.96
8.0.210.0000.00716.97
8.0.200.0040.00416.89
8.0.190.0000.00817.00
8.0.180.0040.00417.00
8.0.170.0080.00016.84
8.0.160.0040.00416.96
8.0.150.0040.00416.87
8.0.140.0050.00316.81
8.0.130.0000.00613.39
8.0.120.0040.00416.86
8.0.110.0040.00416.89
8.0.100.0050.00317.00
8.0.90.0030.00516.85
8.0.80.0130.01016.95
8.0.70.0000.00816.91
8.0.60.0040.00417.03
8.0.50.0000.00716.84
8.0.30.0100.01217.06
8.0.20.0080.01117.40
8.0.10.0000.00816.91
8.0.00.0130.00716.73
7.4.330.0050.00015.00
7.4.320.0070.00016.63
7.4.300.0030.00316.50
7.4.290.0000.00716.52
7.4.280.0000.00716.57
7.4.270.0000.00716.69
7.4.260.0000.00916.64
7.4.250.0000.00816.56
7.4.240.0020.00516.54
7.4.230.0000.00716.59
7.4.220.0140.00416.75
7.4.210.0060.00916.76
7.4.200.0000.00816.43
7.4.160.0100.00716.62
7.4.150.0090.00917.40
7.4.140.0090.00917.86
7.4.130.0070.01016.63
7.4.120.0100.01516.67
7.4.110.0100.00716.48
7.4.100.0090.00916.64
7.4.90.0140.00416.76
7.4.80.0100.00719.39
7.4.70.0040.01416.51
7.4.60.0130.00716.75
7.4.50.0000.00516.66
7.4.40.0110.00516.46
7.4.30.0100.00616.50
7.4.00.0090.00615.15
7.3.330.0000.00513.25
7.3.320.0000.00513.46
7.3.310.0030.00316.52
7.3.300.0070.00016.51
7.3.290.0090.00616.45
7.3.280.0120.00716.46
7.3.270.0040.01217.40
7.3.260.0130.00416.38
7.3.250.0070.01116.52
7.3.240.0060.01016.47
7.3.230.0090.00616.72
7.3.210.0070.01316.43
7.3.200.0080.00819.39
7.3.190.0180.00616.32
7.3.180.0120.00416.68
7.3.170.0060.00916.49
7.3.160.0110.00616.55
7.3.120.0040.00815.05
7.3.10.0030.00916.69
7.3.00.0060.00616.48
7.2.330.0120.01216.45
7.2.320.0130.00616.44
7.2.310.0060.01016.46
7.2.300.0130.00516.71
7.2.290.0130.01016.56
7.2.130.0060.00616.63
7.2.120.0030.00616.69
7.2.110.0060.00616.89
7.2.100.0030.01016.95
7.2.90.0100.00716.69
7.2.80.0110.00016.64
7.2.70.0000.01016.68
7.2.60.0010.01116.91
7.2.50.0080.00016.48
7.2.40.0060.00616.63
7.2.30.0000.01116.57
7.2.20.0000.01116.79
7.2.10.0110.00316.76
7.2.00.0020.01018.00
7.1.250.0070.00315.91
7.1.200.0110.00415.83
7.1.100.0000.01417.95
7.1.70.0000.01217.03
7.1.60.0140.01019.70
7.1.50.0120.01216.79
7.1.00.0070.07322.36
7.0.200.0000.00716.76
7.0.140.0030.07022.21
7.0.100.0100.08019.99
7.0.90.0130.06720.04
7.0.80.0130.05720.02
7.0.70.0070.09019.96
7.0.60.0100.06319.84
7.0.50.0100.06320.46
7.0.40.0030.04320.05
7.0.30.0070.04020.13
7.0.20.0070.04019.95
7.0.10.0100.03320.10
7.0.00.0030.04720.09
5.6.280.0030.07021.15
5.6.250.0070.06020.60
5.6.240.0100.07020.64
5.6.230.0030.09020.50
5.6.220.0030.09020.67
5.6.210.0030.06020.65
5.6.200.0070.07321.09
5.6.190.0070.04021.13
5.6.180.0070.04021.08
5.6.170.0070.04020.99
5.6.160.0030.04021.09
5.6.150.0070.04021.11
5.6.140.0070.04021.12
5.6.130.0030.04320.99
5.6.120.0000.04321.08
5.6.110.0000.03721.02
5.6.100.0070.03720.99
5.6.90.0000.04021.08
5.6.80.0000.03720.39
5.6.70.0030.03720.59
5.6.60.0000.03720.50
5.6.50.0000.03720.38
5.6.40.0000.04020.42
5.6.30.0030.03720.43
5.6.20.0100.03020.40
5.6.10.0100.03320.50
5.6.00.0100.02720.48
5.5.380.0100.07720.37
5.5.370.0070.05720.51
5.5.360.0070.07720.41
5.5.350.0070.08020.32
5.5.340.0200.06720.88
5.5.330.0070.04020.82
5.5.320.0030.04320.80
5.5.310.0030.04320.69
5.5.300.0030.04020.85
5.5.290.0070.04020.84
5.5.280.0000.04320.86
5.5.270.0030.03720.82
5.5.260.0000.04720.96
5.5.250.0130.03320.63
5.5.240.0000.03720.34
5.5.230.0030.03720.07
5.5.220.0030.03720.29
5.5.210.0000.03720.34
5.5.200.0070.03320.32
5.5.190.0070.03720.30
5.5.180.0030.03320.14
5.5.160.0070.03020.13
5.5.150.0100.04020.20
5.5.140.0030.03320.29
5.5.130.0070.03320.26
5.5.120.0070.03320.22
5.5.110.0030.03320.30
5.5.100.0100.03020.15
5.5.90.0030.05020.18
5.5.80.0030.03320.17
5.5.70.0070.08020.02
5.5.60.0000.08020.11
5.5.50.0000.03720.11
5.5.40.0070.03720.10
5.5.30.0070.07320.12
5.5.20.0170.06020.10
5.5.10.0070.06320.05
5.5.00.0030.04020.08
5.4.450.0000.04319.38
5.4.440.0070.03019.36
5.4.430.0030.03319.48
5.4.420.0000.04019.33
5.4.410.0100.03719.24
5.4.400.0030.03318.96
5.4.390.0030.03319.03
5.4.380.0100.03018.95
5.4.370.0030.03319.05
5.4.360.0070.03719.03
5.4.350.0030.03018.85
5.4.340.0030.03719.00
5.4.320.0070.03019.05
5.4.310.0100.02718.91
5.4.300.0070.02718.84
5.4.290.0070.03018.87
5.4.280.0000.03319.18
5.4.270.0130.03019.03
5.4.260.0030.03319.23
5.4.250.0030.03019.12
5.4.240.0030.03019.16
5.4.230.0130.06719.02
5.4.220.0030.07719.04
5.4.210.0070.07319.15
5.4.200.0130.05019.18
5.4.190.0070.06019.11
5.4.180.0100.07318.84
5.4.170.0030.05318.93
5.4.160.0030.04319.16
5.4.150.0070.07019.16
5.4.140.0100.04316.43
5.4.130.0130.06016.42
5.4.120.0130.02316.50
5.4.110.0100.06316.32
5.4.100.0030.04016.52
5.4.90.0000.03716.32
5.4.80.0070.05016.40
5.4.70.0100.03016.38
5.4.60.0100.03016.42
5.4.50.0030.03316.50
5.4.40.0030.07716.46
5.4.30.0000.05316.46
5.4.20.0100.06016.35
5.4.10.0070.03316.41
5.4.00.0030.03715.86
5.3.290.0000.03714.78
5.3.280.0070.07714.79
5.3.270.0000.04014.71
5.3.260.0070.03314.59
5.3.250.0030.03314.67
5.3.240.0000.03714.67
5.3.230.0030.03714.61
5.3.220.0100.02714.61
5.3.210.0070.03314.73
5.3.200.0070.04714.59
5.3.190.0100.06314.76
5.3.180.0070.03714.73
5.3.170.0030.04314.64
5.3.160.0000.04714.63
5.3.150.0070.06014.68
5.3.140.0070.03314.59
5.3.130.0070.04314.59
5.3.120.0030.03714.67
5.3.110.0100.03314.58
5.3.100.0000.04314.16
5.3.90.0030.03314.02
5.3.80.0030.04314.22
5.3.70.0130.03314.11
5.3.60.0170.06714.11
5.3.50.0000.04013.91
5.3.40.0030.04014.05
5.3.30.0100.06713.98
5.3.20.0070.06313.68
5.3.10.0100.04013.85
5.3.00.0000.06013.63

preferences:
40.96 ms | 401 KiB | 5 Q