3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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)
8.3.60.0130.00616.63
8.3.50.0070.01221.99
8.3.40.0140.00718.59
8.3.30.0140.00019.04
8.3.20.0050.00220.20
8.3.10.0030.00623.54
8.3.00.0080.00019.38
8.2.180.0070.01116.63
8.2.170.0090.00622.96
8.2.160.0070.00720.46
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00422.27
8.2.110.0090.00020.27
8.2.100.0040.00817.97
8.2.90.0090.00019.09
8.2.80.0080.00017.97
8.2.70.0080.00017.25
8.2.60.0030.00917.80
8.2.50.0050.00518.07
8.2.40.0040.00419.82
8.2.30.0030.00518.05
8.2.20.0040.00417.49
8.2.10.0050.00218.04
8.2.00.0050.00317.60
8.1.280.0090.00625.92
8.1.270.0060.00322.11
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0060.00323.76
8.1.230.0070.00419.12
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0030.00616.97
8.1.190.0080.00017.10
8.1.180.0030.00518.10
8.1.170.0030.00618.52
8.1.160.0040.00421.88
8.1.150.0040.00418.73
8.1.140.0070.00017.38
8.1.130.0000.00817.79
8.1.120.0050.00217.29
8.1.110.0040.00417.40
8.1.100.0000.00817.39
8.1.90.0000.00817.28
8.1.80.0050.00317.32
8.1.70.0040.00417.32
8.1.60.0000.00817.40
8.1.50.0040.00417.30
8.1.40.0040.00417.48
8.1.30.0050.00317.63
8.1.20.0040.00417.60
8.1.10.0030.00617.44
8.1.00.0060.00717.32
8.0.300.0000.00718.77
8.0.290.0000.00716.75
8.0.280.0070.00018.44
8.0.270.0030.00617.17
8.0.260.0000.00617.18
8.0.250.0040.00416.95
8.0.240.0030.00516.93
8.0.230.0050.00216.82
8.0.220.0030.00516.91
8.0.210.0000.00716.84
8.0.200.0060.00016.99
8.0.190.0060.00316.84
8.0.180.0000.00816.91
8.0.170.0000.00916.86
8.0.160.0040.00416.88
8.0.150.0090.00316.83
8.0.140.0040.00416.88
8.0.130.0000.00613.32
8.0.120.0030.00516.84
8.0.110.0030.00616.75
8.0.100.0000.00716.98
8.0.90.0000.00716.73
8.0.80.0120.00316.86
8.0.70.0040.00416.84
8.0.60.0040.00416.66
8.0.50.0080.00016.82
8.0.30.0030.01617.10
8.0.20.0070.01217.40
8.0.10.0040.00416.95
8.0.00.0110.01016.69
7.4.330.0060.00015.00
7.4.320.0000.00616.32
7.4.300.0060.00016.57
7.4.290.0030.00316.39
7.4.280.0030.00516.57
7.4.270.0040.00416.55
7.4.260.0050.00316.40
7.4.250.0050.00316.45
7.4.240.0030.00416.52
7.4.230.0030.00316.36
7.4.220.0120.01216.52
7.4.210.0110.00416.40
7.4.200.0060.00316.62
7.4.160.0100.00716.19
7.4.150.0150.00417.40
7.4.140.0100.00817.86
7.4.130.0100.00816.40
7.4.120.0050.01116.38
7.4.110.0070.01016.47
7.4.100.0130.01016.28
7.4.90.0110.00616.57
7.4.80.0190.00019.39
7.4.70.0100.00616.56
7.4.60.0100.00716.32
7.4.50.0080.00016.42
7.4.40.0130.00316.46
7.4.30.0100.00716.32
7.4.00.0090.00814.69
7.3.330.0050.00013.12
7.3.320.0000.00713.12
7.3.310.0000.00716.21
7.3.300.0040.00416.30
7.3.290.0070.01316.22
7.3.280.0070.01016.25
7.3.270.0120.00817.40
7.3.260.0160.00616.25
7.3.250.0090.00716.18
7.3.240.0170.00616.43
7.3.230.0150.00416.48
7.3.210.0160.00616.32
7.3.200.0090.01219.39
7.3.190.0100.01316.37
7.3.180.0090.00616.18
7.3.170.0120.01216.32
7.3.160.0090.01516.24
7.3.120.0000.01815.01
7.3.110.0120.00614.85
7.3.100.0070.01014.75
7.3.90.0000.01114.73
7.3.80.0080.00314.71
7.3.70.0070.00314.53
7.3.60.0060.00614.70
7.3.50.0000.01714.70
7.3.40.0060.00914.55
7.3.30.0120.00314.70
7.3.20.0000.01716.58
7.3.10.0070.00716.46
7.3.00.0090.00616.55
7.2.330.0160.00016.32
7.2.320.0120.01316.64
7.2.310.0130.00416.61
7.2.300.0090.00616.30
7.2.290.0070.01116.61
7.2.250.0120.00814.98
7.2.240.0040.01414.87
7.2.230.0100.00614.56
7.2.220.0030.00714.86
7.2.210.0060.00615.18
7.2.200.0030.01015.07
7.2.190.0000.01514.86
7.2.180.0060.00615.06
7.2.170.0040.00814.96
7.2.00.0000.01619.11
7.1.330.0070.00715.62
7.1.320.0030.00615.71
7.1.310.0090.00915.51
7.1.300.0000.01615.27
7.1.290.0060.00615.53
7.1.280.0030.01015.51
7.1.270.0120.00315.55
7.1.260.0030.00615.65
7.1.100.0030.00917.79
7.1.70.0030.00616.80
7.1.60.0160.00919.11
7.1.50.0270.00616.86
7.1.00.0000.08022.41
7.0.200.0130.00016.43
7.0.140.0000.07722.01
7.0.60.0070.08319.89
7.0.50.0070.04017.95
7.0.40.0100.07720.11
7.0.30.0300.06720.12
7.0.20.0270.06720.06
7.0.10.0070.07720.10
7.0.00.0070.07020.22
5.6.210.0000.04320.69
5.6.200.0070.06318.24
5.6.190.0230.06320.61
5.6.180.0230.07320.65
5.6.170.0270.03320.51
5.6.160.0070.08720.58
5.6.150.0130.07718.27
5.6.140.0100.04318.28
5.6.130.0000.04318.15
5.6.120.0070.08321.12
5.6.110.0100.08021.05
5.6.100.0100.07021.04
5.6.90.0030.04721.15
5.6.80.0230.04320.45
5.5.350.4230.03720.48
5.5.340.0070.07317.95
5.5.330.0030.04720.13
5.5.320.0270.07020.31
5.5.310.0370.04320.34
5.5.300.0030.07318.07
5.5.290.0070.07018.09
5.5.280.0100.08320.89
5.5.270.0130.08020.70
5.5.260.0130.05320.90
5.5.250.0000.09320.59
5.5.240.0070.03320.21
5.4.450.0070.06319.48
5.4.440.0830.05319.19
5.4.430.0930.04719.45
5.4.420.0870.00019.54
5.4.410.0630.00019.44
5.4.400.0870.00019.12
5.4.390.0600.00019.16
5.4.380.0630.00019.12
5.4.370.0600.00019.13
5.4.360.0630.00019.13
5.4.350.0630.00019.21
5.4.340.0040.03812.04
5.4.320.0050.04112.52
5.4.310.0050.03912.52
5.4.300.0080.03812.53
5.4.290.0060.04012.52
5.4.280.0030.03912.42
5.4.270.0090.03312.42
5.4.260.0090.03412.42
5.4.250.0050.03812.42
5.4.240.0060.03712.41
5.4.230.0040.04012.41
5.4.220.0050.03712.41
5.4.210.0090.03212.41
5.4.200.0050.04012.41
5.4.190.0060.03712.40
5.4.180.0080.03412.41
5.4.170.0060.03612.41
5.4.160.0030.03712.41
5.4.150.0070.03412.41
5.4.140.0050.03612.09
5.4.130.0060.03612.07
5.4.120.0070.03512.04
5.4.110.0080.03312.03
5.4.100.0060.03512.04
5.4.90.0080.03412.03
5.4.80.0070.03712.03
5.4.70.0060.03812.03
5.4.60.0070.03412.03
5.4.50.0060.03512.03
5.4.40.0050.03612.01
5.4.30.0040.03712.01
5.4.20.0090.03412.01
5.4.10.0060.03812.02
5.4.00.0030.03911.50
5.3.290.0060.03912.80
5.3.280.0070.04612.71
5.3.270.0080.04612.72
5.3.260.0050.04012.72
5.3.250.0030.04012.72
5.3.240.0020.04212.72
5.3.230.0060.04512.71
5.3.220.0060.04012.68
5.3.210.0070.04012.68
5.3.200.0060.04012.68
5.3.190.0060.03812.68
5.3.180.0070.04112.68
5.3.170.0050.03812.67
5.3.160.0050.04612.68
5.3.150.0060.04612.66
5.3.140.0090.04212.66
5.3.130.0090.03812.66
5.3.120.0070.04212.66
5.3.110.0030.05312.66
5.3.100.0040.05012.14
5.3.90.0050.03612.13
5.3.80.0040.04112.11
5.3.70.0040.03912.11
5.3.60.0030.03912.10
5.3.50.0070.03612.04
5.3.40.0040.04112.04
5.3.30.0050.03612.01
5.3.20.0060.03411.79
5.3.10.0060.03411.75
5.3.00.0050.03811.75
5.2.170.0080.0279.24
5.2.160.0050.0299.24
5.2.150.0030.0319.24
5.2.140.0090.0269.24
5.2.130.0080.0259.20
5.2.120.0080.0259.20
5.2.110.0030.0319.21
5.2.100.0040.0289.21
5.2.90.0060.0279.21
5.2.80.0040.0309.20
5.2.70.0060.0289.20
5.2.60.0060.0299.15
5.2.50.0050.0319.12
5.2.40.0040.0309.09
5.2.30.0030.0339.07
5.2.20.0050.0309.06
5.2.10.0070.0288.96
5.2.00.0030.0328.83
5.1.60.0030.0268.11
5.1.50.0040.0248.11
5.1.40.0040.0268.10
5.1.30.0030.0288.43
5.1.20.0040.0268.46
5.1.10.0010.0288.18
5.1.00.0060.0248.18
5.0.50.0040.0216.68
5.0.40.0040.0196.53
5.0.30.0040.0316.35
5.0.20.0050.0176.31
5.0.10.0020.0206.30
5.0.00.0020.0316.29
4.4.90.0040.0144.78
4.4.80.0010.0174.75
4.4.70.0030.0154.75
4.4.60.0030.0154.75
4.4.50.0030.0184.77
4.4.40.0030.0294.70
4.4.30.0030.0154.76
4.4.20.0030.0204.85
4.4.10.0020.0154.84
4.4.00.0030.0244.76
4.3.110.0030.0154.67
4.3.100.0030.0144.67
4.3.90.0030.0134.63
4.3.80.0020.0244.58
4.3.70.0010.0164.63
4.3.60.0010.0164.63
4.3.50.0020.0164.63
4.3.40.0030.0234.54
4.3.30.0030.0153.34
4.3.20.0050.0123.31
4.3.10.0020.0153.27
4.3.00.0130.0237.94

preferences:
45.34 ms | 401 KiB | 5 Q