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, 10 , "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.4.10.0100.01014.98
7.4.00.0110.00714.80
7.3.130.0100.00715.06
7.3.120.0090.00914.79
7.3.110.0060.00914.99
7.3.100.0070.00615.04
7.3.90.0030.01314.89
7.3.80.0050.01114.87
7.3.70.0040.01115.00
7.3.60.0070.00915.00
7.3.50.0070.00814.96
7.3.40.0050.00814.84
7.3.30.0080.00314.94
7.3.20.0070.00816.55
7.3.10.0010.01216.72
7.3.00.0070.00916.68
7.2.260.0000.01814.97
7.2.250.0030.01515.21
7.2.240.0050.01115.16
7.2.230.0050.00915.16
7.2.220.0090.00615.26
7.2.210.0060.00915.09
7.2.200.0080.00714.79
7.2.190.0040.01115.10
7.2.180.0090.00615.09
7.2.170.0050.01115.12
7.2.160.0060.00515.08
7.2.150.0090.00517.03
7.2.140.0070.00716.91
7.2.130.0070.00916.84
7.2.120.0050.00716.74
7.2.110.0030.01016.81
7.2.100.0080.00716.80
7.2.90.0080.00816.79
7.2.80.0010.01116.77
7.2.70.0070.00816.83
7.2.60.0030.01017.01
7.2.50.0090.00616.87
7.2.40.0030.01217.08
7.2.30.0080.00516.94
7.2.20.0030.01216.78
7.2.10.0060.00816.93
7.2.00.0060.01117.63
7.1.330.0070.00815.82
7.1.320.0070.00715.79
7.1.310.0030.01016.01
7.1.300.0070.00915.78
7.1.290.0050.01015.86
7.1.280.0070.00515.74
7.1.270.0050.00615.91
7.1.260.0030.01515.71
7.1.250.0030.01115.94
7.1.240.0070.01015.46
7.1.230.0040.00816.02
7.1.220.0040.00715.95
7.1.210.0060.00315.79
7.1.200.0070.00715.54
7.1.190.0040.01115.91
7.1.180.0040.00815.82
7.1.170.0090.00615.70
7.1.160.0080.00415.77
7.1.150.0040.01115.79
7.1.140.0050.00516.01
7.1.130.0090.00615.91
7.1.120.0000.01115.79
7.1.110.0040.01115.56
7.1.100.0040.00415.88
7.1.90.0040.00415.73
7.1.80.0000.01115.94
7.1.70.0040.00616.57
7.1.60.0080.00816.57
7.1.50.0080.01016.20
7.1.40.0000.01315.66
7.1.30.0070.00715.65
7.1.20.0040.00815.43
7.1.10.0060.00315.52
7.1.00.0040.03919.00
7.0.330.0030.01015.42
7.0.320.0060.00615.64
7.0.310.0030.00715.52
7.0.300.0120.00315.41
7.0.290.0000.00815.41
7.0.280.0030.01015.50
7.0.270.0060.00315.26
7.0.260.0040.00715.50
7.0.250.0100.00315.46
7.0.240.0100.00615.47
7.0.230.0110.00315.54
7.0.220.0030.00615.32
7.0.210.0000.01315.46
7.0.200.0140.00216.06
7.0.190.0070.00315.54
7.0.180.0110.00315.23
7.0.170.0090.00315.65
7.0.160.0060.00615.56
7.0.150.0000.01315.52
7.0.140.0070.03918.71
7.0.130.0060.00615.53
7.0.120.0030.00515.52
7.0.110.0000.00815.19
7.0.100.0000.00815.19
7.0.90.0090.00315.23
7.0.80.0030.00915.39
7.0.70.0060.00615.40
7.0.60.0100.04117.54
7.0.50.0050.02816.78
7.0.40.0080.03516.89
7.0.30.0150.04516.89
7.0.20.0130.04316.90
7.0.10.0080.04516.78
7.0.00.0050.02416.87
5.6.400.0060.00914.55
5.6.390.0040.00814.54
5.6.380.0090.00614.21
5.6.370.0000.00814.49
5.6.360.0060.00914.65
5.6.350.0030.00714.74
5.6.340.0100.00714.21
5.6.330.0070.00714.74
5.6.320.0000.01113.94
5.6.310.0070.00714.31
5.6.300.0030.01314.56
5.6.290.0030.00714.14
5.6.280.0070.03817.60
5.6.270.0070.00714.50
5.6.260.0000.01014.81
5.6.250.0030.00614.52
5.6.240.0130.00314.33
5.6.230.0080.00014.43
5.6.220.0040.01114.46
5.6.210.0030.04617.42
5.6.200.0040.04716.34
5.6.190.0010.02817.60
5.6.180.0120.02517.54
5.6.170.0630.02717.47
5.6.160.0030.02817.52
5.6.150.0050.04516.33
5.6.140.0060.04416.35
5.6.130.0070.02716.18
5.6.120.0050.04617.64
5.6.110.0090.03417.80
5.6.100.0020.04517.80
5.6.90.0050.03517.61
5.6.80.0020.02517.31
5.6.70.0100.00314.39
5.6.60.0050.00514.58
5.6.50.0100.00014.52
5.6.40.0040.00814.22
5.6.30.0040.00814.43
5.6.20.0100.00714.21
5.6.10.0000.01114.40
5.6.00.0100.00314.23
5.5.380.0080.00414.20
5.5.370.0030.00614.16
5.5.360.0040.00814.38
5.5.350.0080.04717.45
5.5.340.0090.04316.18
5.5.330.0100.01817.34
5.5.320.0200.04317.39
5.5.310.0200.03317.32
5.5.300.0050.02416.17
5.5.290.0080.04316.12
5.5.280.0050.03817.79
5.5.270.0120.04017.62
5.5.260.0040.02517.46
5.5.250.0090.04217.35
5.5.240.0110.03017.29
5.5.230.0060.01014.34
5.5.220.0000.00914.25
5.5.210.0100.00614.02
5.5.200.0070.00714.48
5.5.190.0040.01114.53
5.5.180.0100.00714.02
5.5.170.0070.00714.41
5.5.160.0000.01514.46
5.5.150.0030.00914.33
5.5.140.0030.00914.29
5.5.130.0030.01014.48
5.5.120.0030.01014.50
5.5.110.0070.00714.44
5.5.100.0000.01614.48
5.5.90.0100.00014.30
5.5.80.0030.00914.55
5.5.70.0060.00614.21
5.5.60.0080.00014.28
5.5.50.0070.00714.64
5.5.40.0030.01314.13
5.5.30.0000.00914.50
5.5.20.0000.01114.34
5.5.10.0000.00914.56
5.5.00.0060.00914.23
5.4.450.0120.02115.63
5.4.440.0110.02515.61
5.4.430.0080.02415.65
5.4.420.0090.03015.62
5.4.410.0100.02115.54
5.4.400.0110.02015.53
5.4.390.0140.04215.40
5.4.380.0170.02215.51
5.4.370.0190.02515.56
5.4.360.0150.03615.53
5.4.350.0160.02315.52
5.4.340.0050.02715.51
5.4.330.0030.00611.82
5.4.320.0120.02915.33
5.4.310.0130.02315.35
5.4.300.0080.03515.45
5.4.290.0130.03815.35
5.4.280.0140.02315.39
5.4.270.0150.02015.49
5.4.260.0170.03315.45
5.4.250.0100.02615.56
5.4.240.0120.04215.33
5.4.230.0160.02315.47
5.4.220.0150.03815.45
5.4.210.0120.02115.40
5.4.200.0050.03015.45
5.4.190.0130.03815.51
5.4.180.0130.04015.56
5.4.170.0050.03215.48
5.4.160.0170.03415.32
5.4.150.0130.04115.55
5.4.140.0150.02514.09
5.4.130.0080.02814.17
5.4.120.0080.04014.25
5.4.110.0130.02414.05
5.4.100.0120.03914.22
5.4.90.0080.02714.16
5.4.80.0100.02614.19
5.4.70.0180.03514.14
5.4.60.0170.01814.08
5.4.50.0080.02714.19
5.4.40.0150.03314.04
5.4.30.0080.02514.15
5.4.20.0130.02214.16
5.4.10.0100.02014.20
5.4.00.0100.02513.83
5.3.290.0230.07014.75
5.3.280.0170.04714.60
5.3.270.0270.06314.62
5.3.260.0300.06714.56
5.3.250.0270.05314.61
5.3.240.0270.06014.61
5.3.230.0200.03314.61
5.3.220.0230.05314.50
5.3.210.0200.07314.57
5.3.200.0200.05014.52
5.3.190.0230.07314.83
5.3.180.0300.06714.50
5.3.170.0170.04714.67
5.3.160.0200.05714.51
5.3.150.0130.05714.63
5.3.140.0200.07014.52
5.3.130.0130.04314.55
5.3.120.0200.04714.59
5.3.110.0100.04314.48
5.3.100.0230.06014.09
5.3.90.0200.04713.96
5.3.80.0130.06713.96
5.3.70.0200.06714.05
5.3.60.0200.04014.11
5.3.50.0300.03313.91
5.3.40.0200.03713.90
5.3.30.0170.03713.95
5.3.20.0230.06313.74
5.3.10.0200.04013.81
5.3.00.0230.06713.59
5.2.170.0170.03011.33
5.2.160.0230.05711.20
5.2.150.0200.04711.27
5.2.140.0170.05711.33
5.2.130.0200.03311.06
5.2.120.0230.05011.07
5.2.110.0200.05011.05
5.2.100.0270.05011.05
5.2.90.0130.05011.37
5.2.80.0170.06011.28
5.2.70.0170.06311.21
5.2.60.0130.03710.99
5.2.50.0200.05010.96
5.2.40.0200.05310.94
5.2.30.0200.05711.02
5.2.20.0200.04311.13
5.2.10.0230.04710.82
5.2.00.0130.03310.68
5.1.60.0200.04010.02
5.1.50.0170.02710.09
5.1.40.0070.05010.01
5.1.30.0070.05310.49
5.1.20.0030.03010.30
5.1.10.0200.05010.09
5.1.00.1300.02710.01
5.0.50.0630.0278.60
5.0.40.0600.0208.55
5.0.30.0530.0308.16
5.0.20.0730.0278.15
5.0.10.0770.0278.21
5.0.00.0630.0478.13
4.4.90.0500.0178.01
4.4.80.0530.0138.01
4.4.70.0500.0178.01
4.4.60.0670.0278.01
4.4.50.0500.0178.01
4.4.40.0530.0238.01
4.4.30.0630.0238.01
4.4.20.0600.0208.01
4.4.10.0530.0138.01
4.4.00.0570.0278.01
4.3.110.0500.0178.01
4.3.100.0570.0178.01
4.3.90.0530.0138.01
4.3.80.0630.0378.01
4.3.70.0500.0178.01
4.3.60.0000.0178.01
4.3.50.0000.0178.01
4.3.40.0030.0278.01
4.3.30.0000.0208.01
4.3.20.0030.0178.01
4.3.10.0000.0178.01
4.3.00.0000.0178.01

preferences:
39.73 ms | 400 KiB | 5 Q