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 ); } 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.4.00.0030.01615.00
7.3.120.0030.01414.45
7.3.110.0070.01014.59
7.3.100.0040.01114.45
7.3.90.0080.00414.57
7.3.80.0100.00314.48
7.3.70.0070.01014.72
7.3.60.0030.01114.45
7.3.50.0100.00314.70
7.3.40.0030.01014.50
7.3.30.0090.00614.61
7.3.20.0030.00616.60
7.3.10.0060.00616.10
7.3.00.0040.00816.61
7.2.250.0090.00915.14
7.2.240.0000.02014.71
7.2.230.0100.00314.58
7.2.220.0000.01414.95
7.2.210.0060.00614.95
7.2.200.0100.00714.91
7.2.190.0030.00914.63
7.2.180.0110.00414.91
7.2.170.0030.00914.88
7.2.110.0120.00416.58
7.2.100.0120.00616.23
7.2.90.0100.01316.21
7.2.80.0170.00716.55
7.2.70.0110.00716.57
7.2.60.0170.00816.41
7.2.50.0130.01016.61
7.2.40.0170.00016.57
7.2.30.0200.00416.63
7.2.20.0090.00916.79
7.2.10.0130.00816.77
7.2.00.0220.00517.96
7.1.330.0100.00615.66
7.1.320.0030.00615.70
7.1.310.0030.01015.22
7.1.300.0080.00315.52
7.1.290.0090.00315.21
7.1.280.0040.00715.40
7.1.270.0000.01815.64
7.1.260.0080.00415.48
7.1.230.0120.00615.73
7.1.220.0360.00415.61
7.1.210.0050.01415.61
7.1.200.0170.00015.25
7.1.190.0330.01015.65
7.1.180.0140.00315.58
7.1.170.0120.00415.71
7.1.160.0120.00615.66
7.1.150.0200.00015.14
7.1.140.0100.00615.59
7.1.130.0330.00415.68
7.1.120.0090.00615.63
7.1.110.0140.00715.77
7.1.100.0060.00816.69
7.1.90.0140.00615.40
7.1.80.0140.00315.68
7.1.70.0080.00316.26
7.1.60.0100.01217.79
7.1.50.0120.01216.25
7.1.40.0120.00715.65
7.1.30.0070.01315.53
7.1.20.0140.00715.60
7.1.10.0060.00615.55
7.1.00.0070.04118.87
7.0.310.0420.00315.22
7.0.300.0140.00315.29
7.0.290.0100.00515.07
7.0.280.0140.00414.96
7.0.270.0100.00715.08
7.0.260.0130.00415.14
7.0.250.0070.01015.46
7.0.240.0090.00615.34
7.0.230.0220.00615.43
7.0.220.0150.00415.38
7.0.210.0130.00315.41
7.0.200.0070.00715.95
7.0.190.0140.00315.37
7.0.180.0080.00515.36
7.0.170.0070.00715.40
7.0.160.0120.00315.10
7.0.150.0090.00614.91
7.0.140.0080.03918.62
7.0.130.0130.00315.31
7.0.120.0100.00514.90
7.0.110.0040.01115.38
7.0.100.0200.04317.63
7.0.90.0250.04017.65
7.0.80.0350.03517.61
7.0.70.0080.02717.60
7.0.60.0080.05217.61
7.0.50.0110.04117.89
7.0.40.0110.04216.73
7.0.30.0100.02316.67
7.0.20.0100.04016.66
7.0.10.0090.04616.75
7.0.00.0100.04116.58
5.6.380.0100.00713.99
5.6.370.0080.00814.31
5.6.360.0090.00914.06
5.6.350.0100.00714.30
5.6.340.0100.01314.08
5.6.330.0090.00914.18
5.6.320.0070.00714.02
5.6.310.0100.00314.39
5.6.300.0140.00514.26
5.6.290.0080.00814.41
5.6.280.0080.04817.62
5.6.270.0120.00514.14
5.6.260.0080.00814.18
5.6.250.0060.03617.46
5.6.240.0110.03617.54
5.6.230.0050.03317.45
5.6.220.0070.03517.34
5.6.210.0070.04717.48
5.6.200.0110.03517.53
5.6.190.0130.04017.47
5.6.180.0070.04217.63
5.6.170.0090.03717.72
5.6.160.0150.03517.53
5.6.150.0060.03317.52
5.6.140.0090.04317.53
5.6.130.0160.03517.55
5.6.120.0090.04417.54
5.6.110.0040.03117.65
5.6.100.0080.04717.51
5.6.90.0180.03317.63
5.6.80.0100.03717.22
5.6.70.0100.02317.21
5.6.60.0090.04217.32
5.6.50.0060.04517.17
5.6.40.0120.02517.22
5.6.30.0130.03817.25
5.6.20.0120.04017.30
5.6.10.0110.04317.18
5.6.00.0110.04217.23
5.5.380.0120.04216.60
5.5.370.0050.02516.60
5.5.360.0070.04016.60
5.5.350.0060.04316.62
5.5.340.0030.04716.87
5.5.330.0020.03016.85
5.5.320.0060.02916.85
5.5.310.0100.04016.88
5.5.300.0130.03816.83
5.5.290.0080.03816.87
5.5.280.0100.04116.87
5.5.270.0140.03216.73
5.5.260.0140.04016.83
5.5.250.0090.03816.76
5.5.240.0100.04016.42
5.5.230.0140.03716.51
5.5.220.0110.02316.53
5.5.210.0060.03716.52
5.5.200.0100.02716.53
5.5.190.0050.03516.50
5.5.180.0030.03716.53
5.5.170.0070.00814.17
5.5.160.0120.04016.47
5.5.150.0110.03116.53
5.5.140.0050.04016.53
5.5.130.0070.04616.47
5.5.120.0080.03516.52
5.5.110.0020.02916.54
5.5.100.0110.04116.48
5.5.90.0070.04516.47
5.5.80.0060.04116.39
5.5.70.0130.02316.48
5.5.60.0090.03016.46
5.5.50.0090.03916.48
5.5.40.0110.02016.45
5.5.30.0120.03516.45
5.5.20.0090.04416.42
5.5.10.0070.02716.42
5.5.00.0050.03516.42
5.4.450.0140.02015.98
5.4.440.0050.03916.09
5.4.430.0080.04216.00
5.4.420.0100.03816.00
5.4.410.0050.04316.04
5.4.400.0080.03515.85
5.4.390.0040.04415.91
5.4.380.0050.04315.85
5.4.370.0130.02816.02
5.4.360.0080.03315.87
5.4.350.0110.04015.87
5.4.340.0120.03915.92
5.4.330.0040.00812.79
5.4.320.0090.04015.87
5.4.310.0080.04015.85
5.4.300.0050.04416.00
5.4.290.0120.03415.87
5.4.280.0130.01815.94
5.4.270.0110.03316.00
5.4.260.0070.03215.83
5.4.250.0120.02215.91
5.4.240.0100.03415.96
5.4.230.0090.03215.88
5.4.220.0100.03716.00
5.4.210.0090.02115.95
5.4.200.0080.04215.97
5.4.190.0070.04115.91
5.4.180.0130.03716.00
5.4.170.0110.03515.95
5.4.160.0050.04315.95
5.4.150.0150.03515.86
5.4.140.0170.03014.55
5.4.130.0050.03414.62
5.4.120.0070.02414.48
5.4.110.0070.03814.64
5.4.100.0090.03314.66
5.4.90.0030.03514.62
5.4.80.0060.04314.55
5.4.70.0070.03614.57
5.4.60.0050.04214.64
5.4.50.0060.04114.53
5.4.40.0070.02314.66
5.4.30.0100.04014.63
5.4.20.0050.02214.53
5.4.10.0100.01714.57
5.4.00.0050.02614.26
5.3.290.0070.02413.78
5.3.280.0080.03713.71
5.3.270.0080.02113.78
5.3.260.0090.03713.71
5.3.250.0070.04013.74
5.3.240.0070.03313.67
5.3.230.0050.04213.74
5.3.220.0070.02313.75
5.3.210.0020.02513.66
5.3.200.0100.02813.71
5.3.190.0070.01913.66
5.3.180.0090.02213.63
5.3.170.0090.02913.66
5.3.160.0080.03513.70
5.3.150.0070.03613.75
5.3.140.0070.04113.72
5.3.130.0090.03913.68
5.3.120.0090.03913.71
5.3.110.0080.03713.65
5.3.100.0090.03813.47
5.3.90.0060.03913.43
5.3.80.0050.02713.47
5.3.70.0130.03313.41
5.3.60.0140.03513.43
5.3.50.0070.03713.43
5.3.40.0070.03513.43
5.3.30.0050.02513.31
5.3.20.0100.03713.25
5.3.10.0030.04313.27
5.3.00.0030.04513.24
5.2.170.0050.03712.38
5.2.160.0050.02312.38
5.2.150.0070.03312.38
5.2.140.0080.03412.38
5.2.130.0060.02612.38
5.2.120.0030.03612.38
5.2.110.0070.02812.38
5.2.100.0050.03212.38
5.2.90.0050.03312.38
5.2.80.0030.03812.38
5.2.70.0020.02612.38
5.2.60.0080.02212.38
5.2.50.0020.04012.38
5.2.40.0050.03412.38
5.2.30.0030.03412.38
5.2.20.0100.02812.38
5.2.10.0050.02512.38
5.2.00.0090.01612.38
5.1.60.0060.02812.38
5.1.50.0030.03212.38
5.1.40.0020.02712.38
5.1.30.0070.02712.38
5.1.20.0070.02212.38
5.1.10.0060.02312.38
5.1.00.0070.02812.38
5.0.50.0030.02012.38
5.0.40.0030.02312.38
5.0.30.0020.03712.38
5.0.20.0090.01212.38
5.0.10.0060.01312.38
5.0.00.0040.02012.38
4.4.90.0000.02112.38
4.4.80.0030.02012.38
4.4.70.0020.01712.38
4.4.60.0020.01912.38
4.4.50.0020.01912.38
4.4.40.0040.01412.38
4.4.30.0040.01512.38
4.4.20.0000.02312.38
4.4.10.0050.01512.38
4.4.00.0000.01912.38
4.3.110.0000.02312.38
4.3.100.0000.01712.38
4.3.90.0040.00912.38
4.3.80.0050.01212.38
4.3.70.0030.01812.38
4.3.60.0050.01212.38
4.3.50.0020.01312.38
4.3.40.0040.01512.38
4.3.30.0050.01812.38
4.3.20.0020.02112.38
4.3.10.0060.01112.38
4.3.00.0000.01912.38

preferences:
34.84 ms | 401 KiB | 5 Q