3v4l.org

run code in 300+ PHP versions simultaneously
<?php for($i=0;$i<=10000;++$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, 100 , "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.2.00.0070.00719.46
7.1.70.0000.00817.22
7.1.60.0140.01419.11
7.1.50.0120.01516.69
7.1.00.0070.07022.44
7.0.200.0260.00916.21
7.0.140.0030.06722.00
7.0.100.0170.03721.29
7.0.90.0100.06721.24
7.0.80.0200.07721.14
7.0.70.0330.08021.19
7.0.60.0030.09021.21
7.0.50.0170.05721.69
7.0.40.0070.07720.07
7.0.30.0130.05020.20
7.0.20.0030.04720.00
7.0.10.0070.05020.10
7.0.00.0070.07320.09
5.6.280.0030.08023.13
5.6.250.0030.04722.71
5.6.240.0000.08722.75
5.6.230.0070.08322.58
5.6.220.0000.08322.73
5.6.210.0070.09022.70
5.6.200.0130.08023.17
5.6.190.0130.08023.22
5.6.180.0130.05023.16
5.6.170.0030.05023.13
5.6.160.0070.04323.09
5.6.150.0100.07023.12
5.6.140.0100.06023.14
5.6.130.0100.06023.04
5.6.120.0070.05323.04
5.6.110.0100.10023.05
5.6.100.0030.05723.12
5.6.90.0070.07723.14
5.6.80.0230.05022.57
5.6.70.0130.07722.54
5.6.60.0000.08022.40
5.6.50.0170.07022.50
5.6.40.0170.07322.40
5.6.30.0100.08022.46
5.6.20.0070.08322.52
5.6.10.0170.06722.37
5.6.00.0100.06022.47
5.5.380.0070.05722.52
5.5.370.0170.07322.59
5.5.360.0100.06022.39
5.5.350.0100.06322.53
5.5.340.0100.08322.95
5.5.330.0030.06722.96
5.5.320.0100.07722.71
5.5.310.0130.08722.98
5.5.300.0000.09322.95
5.5.290.0030.05322.83
5.5.280.0100.09022.80
5.5.270.0070.08722.92
5.5.260.0100.07022.88
5.5.250.0100.04022.61
5.5.240.0200.07722.28
5.5.230.0000.08022.18
5.5.220.0130.03322.18
5.5.210.0070.06722.22
5.5.200.0130.07322.23
5.5.190.0130.04722.34
5.5.180.0030.06722.29
5.5.160.0130.04322.25
5.5.150.0070.08322.29
5.5.140.0030.05322.15
5.5.130.0130.07022.22
5.5.120.0170.04322.34
5.5.110.0100.07322.06
5.5.100.0170.03722.26
5.5.90.0130.04722.08
5.5.80.0130.07322.02
5.5.70.0070.08322.07
5.5.60.0070.06022.07
5.5.50.0100.06022.22
5.5.40.0030.05322.13
5.5.30.0070.08322.20
5.5.20.0070.08322.12
5.5.10.0070.08022.03
5.5.00.0070.07022.25
5.4.450.0000.04321.54
5.4.440.0030.08321.34
5.4.430.0230.06721.24
5.4.420.0070.06321.44
5.4.410.0030.05321.19
5.4.400.0070.06320.89
5.4.390.0130.08020.95
5.4.380.0030.04320.85
5.4.370.0170.06021.07
5.4.360.0070.07721.05
5.4.350.0200.08720.89
5.4.340.0070.06720.89
5.4.320.0070.07721.12
5.4.310.0070.07021.21
5.4.300.0130.04321.21
5.4.290.0000.04321.03
5.4.280.0070.07021.09
5.4.270.0100.07721.18
5.4.260.0030.07321.02
5.4.250.0070.07721.04
5.4.240.0200.06021.02
5.4.230.0130.07021.03
5.4.220.0100.07321.09
5.4.210.0070.06321.02
5.4.200.0030.08021.02
5.4.190.0070.04020.84
5.4.180.0070.07721.20
5.4.170.0130.06021.17
5.4.160.0100.07320.88
5.4.150.0100.07320.99
5.4.140.0070.07718.54
5.4.130.0030.05018.30
5.4.120.0130.07018.39
5.4.110.0070.07318.38
5.4.100.0170.04018.39
5.4.90.0070.03718.52
5.4.80.0130.05018.32
5.4.70.0070.07318.31
5.4.60.0070.07018.52
5.4.50.0000.06718.41
5.4.40.0070.04318.56
5.4.30.0030.04018.31
5.4.20.0000.06018.37
5.4.10.0030.04718.52
5.4.00.0070.08017.91

preferences:
48.23 ms | 400 KiB | 5 Q