3v4l.org

run code in 300+ PHP versions simultaneously
<?php for($i=0;$i<=100;++$i){ //$urls[] = 'http://search.yahoo.com/?q='.$i.'a'; //&num=100 $urls[] = 'http://www.goo598541e'.$i.'.com/search?q='.$i.'ab'; //$urls[] = 'http://www.google.com/search?q='.$i.'a&num=100'; } $start = microtime(true); rolling_curl($urls, $thr , "cb"); $end = microtime(true); $time = $end - $start; echo '<b>Total time '.round($time , 2).' seconds</b><br />'."\n"; function rolling_curl($urls, $rolling_window = 2 , $callback, $custom_options = null) { // make sure the rolling window isn't greater than the # of urls $rolling_window = (count($urls) < $rolling_window) ? count($urls) : $rolling_window; //$running = null; $master = curl_multi_init(); $curl_arr = array(); // add additional curl options here $std_options = array( CURLOPT_RETURNTRANSFER => true, //CURLOPT_FAILONERROR=> true, CURLOPT_CONNECTTIMEOUT_MS=> 2000, CURLOPT_TIMEOUT_MS=> 2000, CURLOPT_FRESH_CONNECT=> true, CURLOPT_FORBID_REUSE=> true ); $options = ($custom_options) ? ($std_options + $custom_options) : $std_options; // start the first batch of requests for ($i = 0; $i < $rolling_window; ++$i) { $ch = curl_init(); $options[CURLOPT_URL] = $urls[$i]; curl_setopt_array($ch,$options); curl_multi_add_handle($master, $ch); } do { while(($execrun = curl_multi_exec($master, $running)) == CURLM_CALL_MULTI_PERFORM ); if($execrun != CURLM_OK) break; // a request was just completed -- find out which one while($done = curl_multi_info_read($master)) { $info = curl_getinfo($done['handle']); if ($info['http_code'] == 200) { $output = curl_multi_getcontent($done['handle']); // request successful. process output using the callback function. $callback($output , $info['url'] , $start); // start a new request (it's important to do this before removing the old one) if( isset($urls[$i+1]) ) { $ch = curl_init(); $options[CURLOPT_URL] = $urls[$i+1]; ++$i; // increment i curl_setopt_array($ch,$options); curl_multi_add_handle($master, $ch); // remove the curl handle that just completed curl_multi_remove_handle($master, $done['handle']); } else curl_multi_remove_handle($master, $done['handle']); } else { echo curl_error($done['handle'])." - ".$info['url']." <br/>\n\r"; //echo $info['url']." -> error<br>\n\r"; //print_r($info); // request failed. add error handling. if( isset($urls[$i+1]) ) { $ch = curl_init(); $options[CURLOPT_URL] = $urls[$i+1]; ++$i; // increment i curl_setopt_array($ch,$options); curl_multi_add_handle($master, $ch); curl_multi_remove_handle($master, $done['handle']); } // remove the curl handle that just completed else curl_multi_remove_handle($master, $done['handle']); } } } while ($running); curl_multi_close($master); return true; } ?>

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.0060.00916.78
7.3.00.0090.00516.68
7.2.130.0040.00816.87
7.2.120.0070.00716.84
7.2.110.0040.00716.99
7.2.100.0020.01116.70
7.2.90.0030.00816.74
7.2.80.0090.00516.76
7.2.70.0050.00716.80
7.2.60.0050.01016.72
7.2.50.0030.00816.86
7.2.40.0080.00417.03
7.2.30.0080.00516.86
7.2.20.0080.00616.58
7.2.10.0060.00716.87
7.2.00.0070.00616.88
7.1.250.0040.00815.79
7.1.240.0100.00315.56
7.1.230.0070.01115.70
7.1.220.0090.00315.69
7.1.210.0090.00615.52
7.1.200.0040.01115.67
7.1.190.0130.00615.42
7.1.180.0030.01015.78
7.1.170.0060.00615.82
7.1.160.0070.00415.41
7.1.150.0140.00415.64
7.1.140.0100.00515.71
7.1.130.0070.00715.73
7.1.120.0080.00415.53
7.1.110.0130.00315.89
7.1.100.0130.00315.83
7.1.90.0040.00815.60
7.1.80.0120.00315.75
7.1.70.0050.00716.27
7.1.60.0130.00817.47
7.1.50.0120.01225.28
7.1.40.0080.00315.75
7.1.30.0030.01015.61
7.1.20.0070.00315.72
7.1.10.0060.00615.62
7.1.00.0100.03819.06
7.0.330.0030.00915.31
7.0.320.0100.00315.07
7.0.310.0040.00815.22
7.0.300.0060.00615.03
7.0.290.0030.00915.40
7.0.280.0090.00615.09
7.0.270.0070.01015.47
7.0.260.0040.01215.30
7.0.250.0110.00315.27
7.0.240.0060.00315.38
7.0.230.0150.00415.43
7.0.220.0040.01115.36
7.0.210.0030.00915.30
7.0.200.0140.00615.12
7.0.190.0100.00315.03
7.0.180.0030.01015.19
7.0.170.0120.00315.07
7.0.160.0030.01015.54
7.0.150.0090.00615.13
7.0.140.0030.04318.57
7.0.130.0110.00415.24
7.0.120.0090.00315.33
7.0.110.0070.01015.27
7.0.100.0060.00815.13
7.0.90.0120.00615.30
7.0.80.0170.00015.05
7.0.70.0070.00715.39
7.0.60.0100.01817.70
7.0.50.0110.03816.67
7.0.40.0050.05016.57
7.0.30.0250.04316.76
7.0.20.0180.04216.69
7.0.10.0110.02016.88
7.0.00.0020.02616.67
5.6.380.0070.00714.61
5.6.370.0080.00813.96
5.6.360.0000.00714.22
5.6.350.0000.01314.27
5.6.340.0120.00514.28
5.6.330.0030.01014.36
5.6.320.0060.00313.95
5.6.310.0030.01314.34
5.6.300.0040.00914.47
5.6.290.0110.00014.16
5.6.280.0080.03717.63
5.6.270.0030.01714.05
5.6.260.0040.00914.23
5.6.250.0030.01014.09
5.6.240.0050.01014.54
5.6.230.0110.00514.20
5.6.220.0100.00114.46
5.6.210.0080.04717.53
5.6.200.0080.02816.26
5.6.190.0000.03317.38
5.6.180.0180.04117.19
5.6.170.0670.02817.34
5.6.160.0080.03017.48
5.6.150.0050.04416.28
5.6.140.0050.03816.29
5.6.130.0070.02616.03
5.6.120.0070.02517.61
5.6.110.0070.04617.58
5.6.100.0110.04217.63
5.6.90.0090.04817.74
5.6.80.0120.03317.24
5.6.70.0110.00414.21
5.6.60.0070.01113.86
5.6.50.0100.01013.85
5.6.40.0180.00014.18
5.6.30.0170.01014.32
5.6.20.0200.00514.61
5.6.10.0150.00714.51
5.6.00.0230.00014.32
5.5.380.0030.00811.35
5.5.370.0080.00511.21
5.5.360.0040.00811.18
5.5.350.0070.04215.87
5.5.340.0070.02114.58
5.5.330.0070.04515.79
5.5.320.0200.04015.90
5.5.310.0190.02515.71
5.5.300.0050.04614.61
5.5.290.0050.04314.67
5.5.280.0090.02016.11
5.5.270.0050.04115.91
5.5.260.0150.03816.04
5.5.250.0100.01716.00
5.5.240.0050.03015.70
5.5.230.0000.01011.18
5.5.220.0060.00611.20
5.5.210.0070.00411.27
5.5.200.0060.00611.18
5.5.190.0030.01011.18
5.5.180.0040.00811.18
5.5.170.0000.01311.36
5.5.160.0100.00611.27
5.5.150.0080.00311.18
5.5.140.0060.00611.18
5.5.130.0040.00811.29
5.5.120.0070.00411.36
5.5.110.0080.00411.18
5.5.100.0000.01111.36
5.5.90.0060.00611.18
5.5.80.0030.00611.18
5.5.70.0080.00411.18
5.5.60.0030.01011.24
5.5.50.0030.00911.18
5.5.40.0040.01211.36
5.5.30.0040.00411.18
5.5.20.0000.00711.18
5.5.10.0000.01111.18
5.5.00.0060.00311.18
5.4.450.0270.03115.32
5.4.440.0380.03015.33
5.4.430.0100.02515.17
5.4.420.0350.00315.30
5.4.410.0340.00215.23
5.4.400.0340.00415.21
5.4.390.0350.00415.19
5.4.380.0320.00615.14
5.4.370.0330.00315.21
5.4.360.0350.00315.13
5.4.350.0360.00215.13
5.4.340.0030.02211.61
5.4.330.0070.00711.18
5.4.320.0060.02111.86
5.4.310.0060.02011.86
5.4.300.0050.02111.87
5.4.290.0060.02011.86
5.4.280.0060.01911.81
5.4.270.0040.02411.80
5.4.260.0040.02511.81
5.4.250.0080.01911.81
5.4.240.0060.01811.80
5.4.230.0050.02611.80
5.4.220.0060.02511.80
5.4.210.0020.02111.80
5.4.200.0040.02411.81
5.4.190.0060.01911.80
5.4.180.0040.02211.80
5.4.170.0040.02011.80
5.4.160.0040.02311.80
5.4.150.0060.02011.80
5.4.140.0050.01911.64
5.4.130.0020.02111.63
5.4.120.0020.02211.63
5.4.110.0070.02511.61
5.4.100.0040.02511.61
5.4.90.0050.02211.61
5.4.80.0050.02511.61
5.4.70.0040.02611.61
5.4.60.0070.02111.64
5.4.50.0070.02011.61
5.4.40.0040.02111.60
5.4.30.0060.02111.60
5.4.20.0040.02211.60
5.4.10.0070.01911.60
5.4.00.0060.02511.35
5.3.290.0060.02411.99
5.3.280.0110.02011.95
5.3.270.0040.02211.95
5.3.260.0050.02211.95
5.3.250.0050.02211.95
5.3.240.0050.02611.95
5.3.230.0070.02211.95
5.3.220.0050.02411.93
5.3.210.0070.02011.93
5.3.200.0050.02311.93
5.3.190.0060.02211.93
5.3.180.0050.02511.93
5.3.170.0060.02311.93
5.3.160.0030.02511.93
5.3.150.0060.02311.93
5.3.140.0070.02211.93
5.3.130.0040.02511.92
5.3.120.0090.02311.92
5.3.110.0050.02111.92
5.3.100.0040.02411.67
5.3.90.0060.02511.66
5.3.80.0040.02611.66
5.3.70.0060.02111.65
5.3.60.0040.02311.64
5.3.50.0060.02111.62
5.3.40.0040.02311.62
5.3.30.0050.02111.60
5.3.20.0040.02311.49
5.3.10.0050.02111.47
5.3.00.0060.02111.47
5.2.170.0050.01810.22
5.2.160.0050.01810.22
5.2.150.0060.01910.22
5.2.140.0070.01610.21
5.2.130.0020.02110.20
5.2.120.0040.01910.20
5.2.110.0050.01710.20
5.2.100.0040.01710.20
5.2.90.0060.01610.20
5.2.80.0040.01710.20
5.2.70.0040.01910.20
5.2.60.0050.02110.17
5.2.50.0050.01910.16
5.2.40.0040.01710.14
5.2.30.0070.01610.13
5.2.20.0060.01710.13
5.2.10.0020.02010.08
5.2.00.0040.01910.01
5.1.60.0060.0139.65
5.1.50.0030.0169.65
5.1.40.0050.0199.64
5.1.30.0060.0149.82
5.1.20.0010.0209.83
5.1.10.0080.0129.69
5.1.00.0070.0139.69
5.0.50.0040.0158.94
5.0.40.0030.0138.87
5.0.30.0040.0218.78
5.0.20.0040.0168.76
5.0.10.0070.0128.75
5.0.00.0050.0158.74
4.4.90.0010.0117.98
4.4.80.0020.0117.96
4.4.70.0030.0097.96
4.4.60.0060.0097.96
4.4.50.0030.0137.97
4.4.40.0040.0137.95
4.4.30.0020.0127.97
4.4.20.0040.0108.01
4.4.10.0030.0148.01
4.4.00.0050.0147.96
4.3.110.0010.0117.92
4.3.100.0020.0117.92
4.3.90.0030.0107.91
4.3.80.0020.0167.90
4.3.70.0030.0107.90
4.3.60.0050.0087.90
4.3.50.0040.0097.90
4.3.40.0040.0137.88
4.3.30.0030.0107.29
4.3.20.0030.0117.27
4.3.10.0000.0117.25
4.3.00.0030.0149.56

preferences:
43.65 ms | 404 KiB | 6 Q