3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array( "2014-01-20 20:00:00", "2014-01-21 20:00:00", "2014-01-22 14:00:00", "2014-01-22 20:00:00", "2014-01-23 14:00:00", "2014-01-23 20:00:00", "2014-01-25 20:00:00", "2014-01-26 12:00:00", "2014-01-26 20:00:00", "2014-01-31 20:00:00", "2014-02-01 20:00:00" ); $timestamps = array_map("strtotime", $input); $calendar = array(); foreach ($timestamps as $value) { $format = date("d.m.H", $value); list($day, $month, $hour) = explode(".", $format); if (!array_key_exists($month, $calendar)) $calendar[ $month ] = array(); if (!array_key_exists($day, $calendar[ $month ])) $calendar[ $month ][ $day ] = array(); $calendar[ $month ][ $day ][] = $hour; } $ranges = array(); // use reference so removing objects will affect all loops foreach ($calendar as $month => &$dates) { foreach ($dates as $date => $hours) { foreach ($hours as $key=>$hour) { // start checking for groups $currentDate = $date+1; $range = array($date); while (isset($dates[$currentDate]) && ($newkey = array_search($hour, $dates[$currentDate])) !== FALSE) { $range[] = $currentDate; unset($dates[$currentDate][$newkey]); $currentDate++; } // group was found if (count($range) != 1) { $ranges[] = array('dates' => $range, 'hour' => $hour); unset($dates[$date][$key]); } } } } print_r($calendar); print_r($ranges);

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.0160.00318.55
8.3.50.0100.00522.02
8.3.40.0040.01119.13
8.3.30.0060.00919.21
8.3.20.0080.00020.38
8.3.10.0000.00823.65
8.3.00.0080.00020.80
8.2.180.0150.00317.00
8.2.170.0090.00622.96
8.2.160.0090.00620.44
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.61
8.2.110.0090.00022.21
8.2.100.0080.00418.16
8.2.90.0050.00319.34
8.2.80.0040.00417.97
8.2.70.0090.00018.00
8.2.60.0000.01018.03
8.2.50.0090.00018.07
8.2.40.0050.00518.34
8.2.30.0030.00618.43
8.2.20.0040.00418.03
8.2.10.0040.00418.21
8.2.00.0000.00819.64
8.1.280.0070.01025.92
8.1.270.0090.00023.97
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.79
8.1.230.0070.00319.09
8.1.220.0080.00017.79
8.1.210.0090.00018.77
8.1.200.0060.00317.50
8.1.190.0050.00317.47
8.1.180.0080.00018.10
8.1.170.0000.00818.77
8.1.160.0040.00422.11
8.1.150.0000.00718.80
8.1.140.0000.00817.73
8.1.130.0030.00317.97
8.1.120.0000.00717.59
8.1.110.0040.00417.71
8.1.100.0000.00817.68
8.1.90.0000.00717.64
8.1.80.0070.00017.57
8.1.70.0030.00517.55
8.1.60.0060.00317.64
8.1.50.0040.00417.66
8.1.40.0000.00817.60
8.1.30.0000.00817.81
8.1.20.0000.00817.76
8.1.10.0060.00317.63
8.1.00.0040.00417.59
8.0.300.0070.00018.77
8.0.290.0040.00417.13
8.0.280.0040.00418.56
8.0.270.0000.00817.32
8.0.260.0000.00617.37
8.0.250.0030.00317.26
8.0.240.0000.00717.17
8.0.230.0030.00317.27
8.0.220.0050.00317.20
8.0.210.0000.00617.07
8.0.200.0000.00717.20
8.0.190.0080.00017.23
8.0.180.0000.00817.19
8.0.170.0030.00617.17
8.0.160.0000.00717.19
8.0.150.0040.00417.11
8.0.140.0040.00417.05
8.0.130.0000.00613.54
8.0.120.0030.00517.15
8.0.110.0080.00017.08
8.0.100.0040.00417.14
8.0.90.0040.00417.14
8.0.80.0160.00617.17
8.0.70.0030.00617.13
8.0.60.0040.00417.05
8.0.50.0050.00217.05
8.0.30.0050.01417.33
8.0.20.0110.00717.48
8.0.10.0000.00717.20
8.0.00.0120.00617.08
7.4.330.0050.00015.15
7.4.320.0030.00316.68
7.4.300.0000.00816.67
7.4.290.0070.00016.66
7.4.280.0000.00716.75
7.4.270.0050.00316.70
7.4.260.0030.00316.64
7.4.250.0040.00416.54
7.4.240.0050.00216.74
7.4.230.0040.00416.66
7.4.220.0030.01516.80
7.4.210.0070.00716.71
7.4.200.0070.00016.77
7.4.160.0100.00616.80
7.4.150.0090.01617.40
7.4.140.0090.00917.86
7.4.130.0100.00716.75
7.4.120.0090.01116.78
7.4.110.0120.00616.64
7.4.100.0150.00316.74
7.4.90.0110.00616.75
7.4.80.0100.00719.39
7.4.70.0100.00616.67
7.4.60.0170.00016.72
7.4.50.0090.00016.55
7.4.40.0080.00716.80
7.4.30.0060.01016.90
7.4.10.0110.00715.13
7.4.00.0060.01115.01
7.3.330.0050.00013.30
7.3.320.0030.00313.38
7.3.310.0040.00416.46
7.3.300.0000.00716.47
7.3.290.0080.00816.51
7.3.280.0060.01016.50
7.3.270.0040.01417.40
7.3.260.0120.00916.70
7.3.250.0100.01116.47
7.3.240.0100.01316.50
7.3.230.0110.00516.59
7.3.210.0170.00016.41
7.3.200.0190.00319.39
7.3.190.0120.01116.54
7.3.180.0030.01316.72
7.3.170.0140.00616.76
7.3.160.0100.00716.66
7.3.130.0030.01615.03
7.3.120.0040.01315.06
7.3.110.0080.01115.00
7.3.100.0090.01015.07
7.3.90.0060.00814.99
7.3.80.0040.01315.13
7.3.70.0000.01314.89
7.3.60.0090.00515.06
7.3.50.0060.00514.79
7.3.40.0050.00715.01
7.3.30.0060.00515.06
7.3.20.0000.00816.75
7.3.10.0080.00516.67
7.3.00.0100.00316.91
7.2.330.0170.00016.88
7.2.320.0130.00316.66
7.2.310.0070.01016.93
7.2.300.0120.00616.61
7.2.290.0050.01116.84
7.2.260.0120.00615.35
7.2.250.0120.00715.44
7.2.240.0070.00915.15
7.2.230.0050.01015.34
7.2.220.0110.00715.18
7.2.210.0020.00915.28
7.2.200.0050.01115.24
7.2.190.0060.00515.22
7.2.180.0080.00315.30
7.2.170.0050.01015.31
7.2.160.0020.01015.14
7.2.150.0020.00917.07
7.2.140.0060.00916.99
7.2.130.0130.00517.12
7.2.120.0090.00717.12
7.2.110.0040.01317.18
7.2.100.0030.01116.99
7.2.90.0090.00317.09
7.2.80.0110.00517.08
7.2.70.0000.01317.13
7.2.60.0070.00617.02
7.2.50.0000.01117.03
7.2.40.0070.00717.23
7.2.30.0030.01017.10
7.2.20.0090.00617.07
7.2.10.0100.00317.09
7.2.00.0060.00817.99
7.1.330.0020.01216.00
7.1.320.0080.00916.05
7.1.310.0060.00715.86
7.1.300.0030.00915.99
7.1.290.0050.00615.68
7.1.280.0050.00515.92
7.1.270.0060.00815.96
7.1.260.0030.00816.12
7.1.250.0040.00715.97
7.1.240.0040.01015.92
7.1.230.0100.00315.83
7.1.220.0050.00916.10
7.1.210.0050.00715.90
7.1.200.0040.00816.08
7.1.190.0030.00816.05
7.1.180.0040.00815.94
7.1.170.0040.00716.01
7.1.160.0040.01016.05
7.1.150.0060.00615.87
7.1.140.0060.00415.91
7.1.130.0060.00815.85
7.1.120.0090.00515.89
7.1.110.0040.01015.90
7.1.100.0050.01116.75
7.1.90.0070.00715.94
7.1.80.0090.00415.93
7.1.70.0060.00516.37
7.1.60.0080.00917.22
7.1.50.0060.00616.33
7.1.40.0040.00816.04
7.1.30.0080.00915.96
7.1.20.0040.01115.88
7.1.10.0020.01015.81
7.1.00.0070.03018.23
7.0.330.0090.00815.41
7.0.320.0050.01015.62
7.0.310.0030.01615.55
7.0.300.0090.00715.49
7.0.290.0070.00715.52
7.0.280.0030.01015.61
7.0.270.0060.00515.64
7.0.260.0050.01115.68
7.0.250.0060.00615.66
7.0.240.0000.01315.56
7.0.230.0050.00915.51
7.0.220.0060.00915.59
7.0.210.0050.01115.63
7.0.200.0040.00916.08
7.0.190.0090.00515.68
7.0.180.0070.00815.64
7.0.170.0070.00715.69
7.0.160.0090.00715.50
7.0.150.0050.00715.66
7.0.140.0050.03117.76
7.0.130.0020.01315.57
7.0.120.0090.00915.62
7.0.110.0040.01115.72
7.0.100.0160.02917.10
7.0.90.0100.03716.96
7.0.80.0040.02117.06
7.0.70.0090.03017.08
7.0.60.0150.03016.93
7.0.50.0090.02417.13
7.0.40.0070.02015.82
7.0.30.0090.03415.94
7.0.20.0090.02515.76
7.0.10.0090.02115.81
7.0.00.0060.01815.83
5.6.400.0120.00514.62
5.6.390.0040.00714.91
5.6.380.0050.00714.47
5.6.370.0130.00114.84
5.6.360.0060.01014.64
5.6.350.0090.00614.54
5.6.340.0090.00614.63
5.6.330.0070.01014.71
5.6.320.0080.00614.89
5.6.310.0040.01014.61
5.6.300.0080.00514.52
5.6.290.0080.00814.66
5.6.280.0080.02916.81
5.6.270.0040.01414.78
5.6.260.0100.00614.56
5.6.250.0070.03216.68
5.6.240.0070.03116.58
5.6.230.0050.01816.67
5.6.220.0100.03116.55
5.6.210.0040.02216.61
5.6.200.0090.02816.80
5.6.190.0100.03116.77
5.6.180.0080.02616.73
5.6.170.0100.01816.67
5.6.160.0080.03216.86
5.6.150.0090.03216.69
5.6.140.0090.02516.73
5.6.130.0060.02516.77
5.6.120.0030.02716.71
5.6.110.0100.03016.86
5.6.100.0120.02616.82
5.6.90.0050.02516.76
5.6.80.0080.02916.40
5.6.70.0080.02616.57
5.6.60.0130.01716.41
5.6.50.0100.01716.41
5.6.40.0040.03116.52
5.6.30.0090.02916.52
5.6.20.0090.02916.51
5.6.10.0110.01716.47
5.6.00.0100.02916.43
5.5.380.0090.02716.54
5.5.370.0040.02916.69
5.5.360.0020.03616.57
5.5.350.0060.03316.59
5.5.340.0080.03316.63
5.5.330.0080.03416.69
5.5.320.0090.03016.63
5.5.310.0040.02916.70
5.5.300.0110.02916.67
5.5.290.0010.03216.53
5.5.280.0060.03516.80
5.5.270.0120.03016.69
5.5.260.0060.03016.63
5.5.250.0050.02816.63
5.5.240.0070.03016.29
5.5.230.0100.03116.40
5.5.220.0090.03116.29
5.5.210.0020.03616.48
5.5.200.0080.03116.48
5.5.190.0080.03016.44
5.5.180.0100.02216.28
5.5.170.0020.01214.31
5.5.160.0040.03416.46
5.5.150.0080.02716.36
5.5.140.0020.02616.36
5.5.130.0090.02516.27
5.5.120.0060.02316.51
5.5.110.0100.02716.58
5.5.100.0070.03116.32
5.5.90.0100.02016.48
5.5.80.0070.02916.40
5.5.70.0080.02316.41
5.5.60.0040.02616.41
5.5.50.0060.02816.39
5.5.40.0070.02916.37
5.5.30.0050.03616.44
5.5.20.0110.03016.29
5.5.10.0050.03416.32
5.5.00.0050.01816.36
5.4.450.0060.03014.88
5.4.440.0050.03114.79
5.4.430.0070.02114.82
5.4.420.0050.02614.82
5.4.410.0080.01814.72
5.4.400.0030.02314.61
5.4.390.0090.02814.67
5.4.380.0070.02414.62
5.4.370.0060.03014.51
5.4.360.0070.03014.51
5.4.350.0050.01914.71
5.4.340.0080.02014.61
5.4.330.0070.00512.46
5.4.320.0060.02614.70
5.4.310.0060.02814.51
5.4.300.0070.01914.55
5.4.290.0040.03114.70
5.4.280.0070.03114.65
5.4.270.0060.02314.55
5.4.260.0080.02914.74
5.4.250.0050.02814.65
5.4.240.0050.01814.71
5.4.230.0070.02714.66
5.4.220.0050.02614.76
5.4.210.0110.01514.59
5.4.200.0060.03214.69
5.4.190.0070.02814.54
5.4.180.0070.02114.73
5.4.170.0060.01914.72
5.4.160.0060.02014.73
5.4.150.0060.03114.59
5.4.140.0060.03313.72
5.4.130.0060.02013.76
5.4.120.0040.02613.79
5.4.110.0060.02113.79
5.4.100.0050.03213.76
5.4.90.0050.02313.85
5.4.80.0050.01913.88
5.4.70.0060.03013.76
5.4.60.0040.03313.71
5.4.50.0070.01613.83
5.4.40.0110.02413.80
5.4.30.0090.02613.84
5.4.20.0040.02213.77
5.4.10.0020.03513.86
5.4.00.0050.02813.54
5.3.290.0070.02713.11
5.3.280.0100.02913.03
5.3.270.0100.02813.06
5.3.260.0050.02013.03
5.3.250.0040.03113.05
5.3.240.0090.02613.01
5.3.230.0080.02712.94
5.3.220.0020.02712.99
5.3.210.0030.03012.89
5.3.200.0050.01712.92
5.3.190.0050.01913.03
5.3.180.0080.02713.06
5.3.170.0050.02113.06
5.3.160.0050.02313.06
5.3.150.0050.01513.08
5.3.140.0050.03112.98
5.3.130.0090.02613.01
5.3.120.0110.02213.03
5.3.110.0060.02713.02
5.3.100.0110.02112.86
5.3.90.0040.02912.83
5.3.80.0060.02712.75
5.3.70.0010.03112.76
5.3.60.0040.02912.83
5.3.50.0050.02912.76
5.3.40.0080.02212.82
5.3.30.0170.01912.84
5.3.20.0060.02812.64
5.3.10.0020.03112.63
5.3.00.0090.02012.60
5.2.170.0100.06011.86
5.2.160.0070.07311.86
5.2.150.0070.06311.86
5.2.140.0070.06011.86
5.2.130.0030.06711.86
5.2.120.0100.06011.86
5.2.110.0000.06011.86
5.2.100.0100.02711.86
5.2.90.0100.04011.86
5.2.80.0100.06011.86
5.2.70.0070.05711.86
5.2.60.0030.06711.86
5.2.50.0030.06711.86
5.2.40.0130.05311.86
5.2.30.0100.05311.86
5.2.20.0070.05711.86
5.2.10.0030.05011.86
5.2.00.0030.05711.86
5.1.60.0070.04711.86
5.1.50.0070.05711.86
5.1.40.0030.03711.86
5.1.30.0100.03011.86
5.1.20.0030.03711.86
5.1.10.0100.04711.86
5.1.00.0070.05311.86
5.0.50.0070.04311.86
5.0.40.0030.04311.86
5.0.30.0030.06011.86
5.0.20.0000.04011.86
5.0.10.0070.04311.86
5.0.00.0030.06311.86
4.4.90.0070.03311.86
4.4.80.0030.02711.86
4.4.70.0030.03011.86
4.4.60.0030.02711.86
4.4.50.0000.03711.86
4.4.40.0070.05011.86
4.4.30.0000.02311.86
4.4.20.0030.03311.86
4.4.10.0000.03311.86
4.4.00.0030.05011.86
4.3.110.0030.02711.86
4.3.100.0030.03011.86
4.3.90.0100.02011.86
4.3.80.0070.05011.86
4.3.70.0000.02711.86
4.3.60.0000.02311.86
4.3.50.0030.03311.86
4.3.40.0030.03711.86
4.3.30.0030.03011.86
4.3.20.0000.03011.86
4.3.10.0000.03711.86
4.3.00.0000.01711.86

preferences:
49.22 ms | 401 KiB | 5 Q