3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parse( $limiter = null ) { /** * Start parsing! */ $return_values = curl_multi_download( array( "users/" . userid, 'projects', 'comments/?o=-submit_date&page_size=5', 'tasks/?deadline=5', ), urlpath ); /** * End parsing! */ switch ( $limiter ) { case 'index': $return = array( 'projects' => $return_values['projects'], 'username' => $return_values['users/' . userid]['username'], 'calander_num' => '2', 'alerts_num' => '32', 'messages_num' => '123', '7_days_tasks_due' => '10' ); break; case 'dashboard': $return = array( 'username' => $return_values['users/' . userid]['username'], 'recent_comments' => $return_values['comments/?o=-submit_date&page_size=5'], 't_7_days' => day_counter($return_values['tasks/?deadline=5'], 7), 'projects' => $return_values['projects'] ); break; default: return null; break; } return $return; } function day_counter($array, $index) { $datearray = array(); foreach ($array['results'] as $key => &$value) { array_push($datearray , $array['results'][$key]['deadline']); } $datearray = array_count_values($datearray); for ($i = 0; $i < $index; $i++) { if (isset($datearray[date('Y-m-d', strtotime('+'.$i.' day', time()))])) { $return[$i] = $datearray[date('Y-m-d', strtotime('+'.$i.' day', time()))]; } else { $return[$i] = 0; } } return $return; } function curl_multi_download( array $urls, $urlpath, array $custom_options = array() ) { // make sure the rolling window isn't greater than the # of urls $rolling_window = 20; $rolling_window = ( sizeof( $urls ) < $rolling_window ) ? sizeof( $urls ) : $rolling_window; $master = curl_multi_init(); $curl_arr = array(); $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, ) + $custom_options; // start the first batch of requests for ( $i = 0; $i < $rolling_window; $i++ ) { $ch = curl_init(); $options[CURLOPT_URL] = $urlpath . $urls[$i]; curl_setopt_array( $ch, $options ); curl_multi_add_handle( $master, $ch ); } $return_values = array(); 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'] ); // request successful. process output using the callback function. $output = curl_multi_getcontent( $done['handle'] ); // call_user_func_array($callback, array($info, $output)); if ( $info['http_code'] == '200' ) { //print_r(curl_getinfo($done['handle'])); //$return_values[curl_getinfo($done['handle'])['url']] = json_decode( $output, true ); $return_values[rtrim( substr( curl_getinfo($done['handle'])['url'], strlen ($urlpath) ), '/' )] = json_decode( $output, true ); } // var_dump($return_values); if ( isset( $urls[$i + 1] ) ) { // start a new request (it's important to do this before removing the old one) $ch = curl_init(); $options[CURLOPT_URL] = $urlpath . $urls[$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'] ); } } while ( $running ); curl_multi_close( $master ); return $return_values; }

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.60.0030.00616.50
7.2.00.0110.00419.21
7.1.200.0050.00515.79
7.1.100.0030.01218.08
7.1.70.0070.00717.04
7.1.60.0130.01319.70
7.1.50.0100.01016.85
7.1.00.0030.07722.35
7.0.200.0130.00016.34
7.0.140.0070.07022.13
7.0.90.0100.04320.02
7.0.80.0000.07319.93
7.0.70.0070.05020.06
7.0.60.0000.05719.86
7.0.50.0030.08320.43
7.0.40.0170.07020.14
7.0.30.0030.06720.08
7.0.20.0170.07720.07
7.0.10.0170.08020.09
7.0.00.0030.06019.95
5.6.280.0000.09720.90
5.6.240.0100.05020.70
5.6.230.0130.05320.53
5.6.220.0130.04320.58
5.6.210.0000.05320.67
5.6.200.0130.08021.12
5.6.190.0070.07721.01
5.6.180.0030.06321.07
5.6.170.0100.08321.20
5.6.160.0030.08321.04
5.6.150.0100.08021.03
5.6.140.0100.07720.97
5.6.130.0100.08721.07
5.6.120.0170.07021.11
5.6.110.0030.05320.97
5.6.100.0030.06321.04
5.6.90.0130.06020.96
5.6.80.0130.06720.49
5.6.70.0030.09020.36
5.6.60.0100.04020.36
5.6.50.0170.05720.46
5.6.40.0030.08020.40
5.6.30.0100.06320.42
5.6.20.0030.05020.43
5.6.10.0130.07320.42
5.6.00.0070.07320.41
5.5.380.0100.07320.54
5.5.370.0100.07720.42
5.5.360.0030.07320.38
5.5.350.0030.04720.37
5.5.340.0070.08020.86
5.5.330.0100.07720.67
5.5.320.0070.05020.79
5.5.310.0130.06320.89
5.5.300.0070.04720.86
5.5.290.0130.07020.66
5.5.280.0030.07020.94
5.5.270.0200.05020.84
5.5.260.0100.08020.84
5.5.250.0000.05720.63
5.5.240.0070.03720.27
5.5.230.0170.07020.21
5.5.220.0070.08320.26
5.5.210.0030.08020.30
5.5.200.0100.06720.29
5.5.190.0100.07020.18
5.5.180.0030.04720.15
5.5.160.0070.04320.25
5.5.150.0030.08020.11
5.5.140.0030.04720.27
5.5.130.0170.03720.17
5.5.120.0070.06020.30
5.5.110.0100.04020.11
5.5.100.0030.08320.11
5.5.90.0100.07320.18
5.5.80.0170.06020.13
5.5.70.0170.08020.15
5.5.60.0100.07720.06
5.5.50.0070.07720.16
5.5.40.0130.08020.03
5.5.30.0030.04020.10
5.5.20.0030.08020.09
5.5.10.0170.07020.14
5.5.00.0100.08020.06
5.4.450.0130.07719.59
5.4.440.0130.06319.27
5.4.430.0130.06319.50
5.4.420.0070.07319.44
5.4.410.0100.05019.32
5.4.400.0130.07019.04
5.4.390.0130.06318.88
5.4.380.0100.07719.23
5.4.370.0100.04719.24
5.4.360.0100.07319.21
5.4.350.0130.07319.00
5.4.340.0100.07019.12
5.4.320.0130.07019.03
5.4.310.0070.03719.05
5.4.300.0070.06718.84
5.4.290.0100.07319.05
5.4.280.0100.06719.18
5.4.270.0030.04719.04
5.4.260.0100.06719.12
5.4.250.0030.07019.08
5.4.240.0100.05319.15
5.4.230.0030.05018.87
5.4.220.0070.07319.02
5.4.210.0030.07719.03
5.4.200.0100.06019.12
5.4.190.0100.06718.89
5.4.180.0100.05318.84
5.4.170.0070.07719.15
5.4.160.0170.07319.11
5.4.150.0170.06319.19
5.4.140.0030.06016.51
5.4.130.0070.07016.51
5.4.120.0100.05016.48
5.4.110.0030.05016.39
5.4.100.0070.07716.33
5.4.90.0070.06016.52
5.4.80.0030.07716.40
5.4.70.0170.06316.53
5.4.60.0100.04016.44
5.4.50.0070.04016.34
5.4.40.0030.07316.49
5.4.30.0030.04016.47
5.4.20.0000.07716.37
5.4.10.0100.04716.36
5.4.00.0070.05315.93
5.3.290.0100.07014.79
5.3.280.0100.06714.55
5.3.270.0030.06014.65
5.3.260.0070.07314.68
5.3.250.0070.07714.70
5.3.240.0000.08014.63
5.3.230.0070.07014.58
5.3.220.0100.07014.59
5.3.210.0030.04714.52
5.3.200.0070.04014.62
5.3.190.0070.05314.58
5.3.180.0000.04314.64
5.3.170.0130.06714.54
5.3.160.0030.06314.73
5.3.150.0030.07714.54
5.3.140.0030.07314.57
5.3.130.0030.08014.50
5.3.120.0070.07714.63
5.3.110.0100.06014.63
5.3.100.0070.05014.18
5.3.90.0030.04314.19
5.3.80.0130.07014.11
5.3.70.0000.04714.16
5.3.60.0070.06314.09
5.3.50.0100.04313.95
5.3.40.0070.07013.99
5.3.30.0130.06313.98
5.3.20.0100.04313.70
5.3.10.0100.06713.71
5.3.00.0200.04013.77
5.2.170.0030.04011.09
5.2.160.0030.05311.03
5.2.150.0070.04711.24
5.2.140.0070.04011.23
5.2.130.0000.06311.18
5.2.120.0070.05311.20
5.2.110.0030.04311.19
5.2.100.0070.06711.25
5.2.90.0100.03711.20
5.2.80.0100.05311.19
5.2.70.0030.03311.13
5.2.60.0130.04710.98
5.2.50.0030.04011.18
5.2.40.0070.05711.12
5.2.30.0100.05710.90
5.2.20.0000.07010.99
5.2.10.0030.03310.90
5.2.00.0030.06010.87
5.1.60.0070.05310.28
5.1.50.0000.05710.28
5.1.40.0070.04010.28
5.1.30.0070.05310.36
5.1.20.0030.03010.32
5.1.10.0070.05010.28
5.1.00.0100.05010.28
5.0.50.0030.04010.28
5.0.40.0030.05310.28
5.0.30.0100.04310.28
5.0.20.0030.04710.28
5.0.10.0000.03310.28
5.0.00.0000.06710.28
4.4.90.0070.03010.28
4.4.80.0070.01710.28
4.4.70.0000.03310.28
4.4.60.0000.03310.28
4.4.50.0000.03310.28
4.4.40.0030.04710.28
4.4.30.0030.03310.28
4.4.20.0030.02710.28
4.4.10.0000.02310.28
4.4.00.0000.04710.28
4.3.110.0030.03310.28
4.3.100.0000.03310.28
4.3.90.0030.03310.28
4.3.80.0030.02310.28
4.3.70.0030.03310.28
4.3.60.0070.02310.28
4.3.50.0030.02310.28
4.3.40.0100.03710.28
4.3.30.0000.03710.28
4.3.20.0000.03310.28
4.3.10.0070.02010.28
4.3.00.0030.02710.28

preferences:
34.67 ms | 400 KiB | 5 Q