3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dateDiff($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $i[0] = 60; $i[1] = 24; $i[2] = array(31, (date('L', strtotime('-1 year', $second)) ? 28 : 29), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $months = 0; $days = 0; $tempDays = $inbetween / $i[0] / $i[0] / $i[1] / 365.25; var_dump($tempDays); $tempMonth = date('n', strtotime('-1 year', $second)) - 1; for($n = 0; $n < 12; $n++) { if($tempDays >= $i[2][$tempMonth]) { $months += 1; $tempDays -= $i[2][$tempMonth]; } else { $days = floor($tempDays); break; } $tempMonth = $tempMonth < 10 ? $tempMonth + 1 : 0; } $years = floor(date('Y', $second) - date('Y', $first) + $months / 12); $months = $months % 12; $hours = floor($inbetween / $i[0] / $i[0] % $i[1]); $minutes = floor($inbetween / $i[0] % $i[0]); $seconds = $inbetween % $i[0]; $dateObj = new stdClass(); $dateObj->years = $years; $dateObj->months = $months; $dateObj->days = $days; $dateObj->hours = $hours; $dateObj->minutes = $minutes; $dateObj->seconds = $seconds; return $dateObj; } $mydate = dateDiff(1388534400, 1417392000); echo $mydate->years, " years, ", $mydate->months, " months, ", $mydate->days, " days, ", $mydate->hours, " hours, ", $mydate->minutes, " minutes, and ", $mydate->seconds, " seconds";

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.0120.00318.44
8.3.50.0120.00721.33
8.3.40.0070.00718.79
8.3.30.0070.00720.47
8.3.20.0030.00620.25
8.3.10.0040.00422.23
8.3.00.0060.00322.66
8.2.180.0120.00318.79
8.2.170.0060.00922.96
8.2.160.0030.01022.21
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00420.88
8.2.110.0040.00419.33
8.2.100.0110.00018.28
8.2.90.0040.00419.48
8.2.80.0000.00818.13
8.2.70.0050.00318.00
8.2.60.0060.00318.05
8.2.50.0080.00018.10
8.2.40.0000.00820.66
8.2.30.0040.00419.59
8.2.20.0000.00718.03
8.2.10.0040.00418.14
8.2.00.0040.00418.05
8.1.280.0060.01225.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00319.57
8.1.230.0060.00617.89
8.1.220.0050.00318.03
8.1.210.0000.00818.77
8.1.200.0030.00617.85
8.1.190.0000.00917.85
8.1.180.0030.00618.10
8.1.170.0000.01118.93
8.1.160.0000.00722.32
8.1.150.0000.00719.05
8.1.140.0000.00817.88
8.1.130.0030.00317.98
8.1.120.0040.00417.74
8.1.110.0000.00817.81
8.1.100.0000.00717.79
8.1.90.0040.00417.72
8.1.80.0040.00417.83
8.1.70.0000.00717.80
8.1.60.0060.00317.89
8.1.50.0000.00917.71
8.1.40.0000.00817.83
8.1.30.0030.00517.88
8.1.20.0080.00017.97
8.1.10.0080.00017.88
8.1.00.0050.00217.80
8.0.300.0040.00418.77
8.0.290.0040.00417.13
8.0.280.0030.00318.70
8.0.270.0000.00717.51
8.0.260.0050.00317.24
8.0.250.0050.00317.36
8.0.240.0080.00017.34
8.0.230.0030.00317.38
8.0.220.0070.00017.23
8.0.210.0000.00717.30
8.0.200.0030.00317.39
8.0.190.0050.00317.37
8.0.180.0080.00017.37
8.0.170.0050.00217.38
8.0.160.0000.00717.38
8.0.150.0000.00717.22
8.0.140.0000.00717.20
8.0.130.0000.00513.70
8.0.120.0040.00417.25
8.0.110.0040.00417.18
8.0.100.0000.00817.22
8.0.90.0040.00417.29
8.0.80.0030.01217.42
8.0.70.0050.00317.45
8.0.60.0000.00817.26
8.0.50.0040.00417.32
8.0.30.0060.01617.58
8.0.20.0100.01217.40
8.0.10.0000.00817.51
8.0.00.0100.00917.01
7.4.330.0050.00016.91
7.4.320.0000.00716.89
7.4.300.0060.00016.84
7.4.290.0000.00716.82
7.4.280.0000.00716.89
7.4.270.0000.00716.91
7.4.260.0030.00313.52
7.4.250.0000.00816.77
7.4.240.0010.00616.88
7.4.230.0080.00016.80
7.4.220.0070.01116.78
7.4.210.0040.01316.92
7.4.200.0000.00716.95
7.4.190.0000.00816.78
7.4.160.0130.01016.96
7.4.150.0130.00917.40
7.4.140.0080.00917.86
7.4.130.0160.00716.73
7.4.120.0060.01116.74
7.4.110.0080.00816.68
7.4.100.0150.00416.86
7.4.90.0080.00817.07
7.4.80.0070.01119.39
7.4.70.0100.00716.82
7.4.60.0030.01316.86
7.4.50.0060.00317.02
7.4.40.0050.00522.77
7.4.30.0090.01416.61
7.4.00.0030.01015.29
7.3.330.0000.00613.65
7.3.320.0000.00513.51
7.3.310.0000.00716.43
7.3.300.0030.00316.70
7.3.290.0090.00416.64
7.3.280.0060.01116.59
7.3.270.0170.00317.40
7.3.260.0140.00718.24
7.3.250.0110.00716.64
7.3.240.0110.00416.59
7.3.230.0120.01216.85
7.3.210.0120.00916.77
7.3.200.0060.01219.39
7.3.190.0090.01216.83
7.3.180.0100.00616.88
7.3.170.0120.00316.70
7.3.160.0120.01216.83
7.3.120.0100.00314.79
7.3.00.0170.00316.60
7.2.330.0150.00316.85
7.2.320.0150.00916.96
7.2.310.0100.00716.99
7.2.300.0040.01216.91
7.2.290.0030.01416.96
7.2.130.0120.00416.95
7.2.120.0090.00916.99
7.2.110.0150.00317.18
7.2.100.0130.00717.05
7.2.90.0130.00717.09
7.2.80.0170.00316.52
7.2.70.0040.01516.98
7.2.60.0060.01016.88
7.2.50.0000.01717.08
7.2.40.0040.01417.05
7.2.30.0070.00416.96
7.2.20.0180.00417.10
7.2.10.0150.00316.77
7.2.00.0060.00317.22
7.1.250.0130.00315.98
7.1.240.0150.00015.87
7.1.230.0030.01315.96
7.1.220.0090.00615.82
7.1.210.0150.00315.75
7.1.200.0100.00715.86
7.1.190.0060.00915.89
7.1.180.0040.00816.00
7.1.170.0100.00615.85
7.1.160.0030.00915.66
7.1.150.0060.01115.85
7.1.140.0060.00915.99
7.1.130.0130.00315.70
7.1.120.0090.00315.85
7.1.110.0130.00015.63
7.1.100.0060.00617.22
7.1.90.0040.01116.12
7.1.80.0100.00315.97
7.1.70.0060.00716.62
7.1.60.0050.00816.45
7.1.50.0040.00916.60
7.1.40.0090.00315.95
7.1.30.0090.00315.86
7.1.20.0110.00415.86
7.1.10.0120.00615.60
7.1.00.0080.02019.11
7.0.330.0030.00915.41
7.0.320.0120.00315.57
7.0.310.0110.00715.29
7.0.300.0080.00415.20
7.0.290.0090.00415.14
7.0.280.0090.00515.40
7.0.270.0120.00315.34
7.0.260.0050.01015.38
7.0.250.0090.00515.34
7.0.240.0110.00015.40
7.0.230.0080.00615.55
7.0.220.0040.00415.43
7.0.210.0060.00615.23
7.0.200.0050.00516.00
7.0.190.0100.00615.45
7.0.180.0040.00415.34
7.0.170.0030.01015.33
7.0.160.0110.00015.58
7.0.150.0110.00715.55
7.0.140.0030.03818.77
7.0.130.0150.00515.52
7.0.120.0140.00715.80
7.0.110.0070.01015.32
7.0.100.0170.00515.29
7.0.90.0100.03317.68
7.0.80.0060.02917.76
7.0.70.0090.03717.67
7.0.60.0100.04717.61
7.0.50.0110.01817.84
7.0.40.0070.02016.70
7.0.30.0070.02616.85
7.0.20.0060.04416.69
7.0.10.0080.04516.74
7.0.00.0070.04416.78
5.6.380.0030.01214.67
5.6.370.0040.01114.55
5.6.360.0110.00614.52
5.6.350.0130.00514.09
5.6.340.0040.01114.35
5.6.330.0110.00314.65
5.6.320.0040.01314.71
5.6.310.0110.00514.64
5.6.300.0100.00614.57
5.6.290.0030.01214.36
5.6.280.0050.04017.71
5.6.270.0040.01214.35
5.6.260.0040.00814.29
5.6.250.0080.00814.39
5.6.240.0060.04817.62
5.6.230.0020.02717.52
5.6.220.0090.02517.35
5.6.210.0080.04117.40
5.6.200.0040.02617.67
5.6.190.0050.04917.59
5.6.180.0050.03317.71
5.6.170.0060.04117.56
5.6.160.0040.02317.71
5.6.150.0090.04317.70
5.6.140.0060.02517.73
5.6.130.0050.05017.82
5.6.120.0130.04017.65
5.6.110.0070.03217.66
5.6.100.0050.02617.61
5.6.90.0050.02317.87
5.6.80.0100.03517.46
5.6.70.0020.02817.41
5.6.60.0050.04617.42
5.6.50.0060.03317.26
5.6.40.0020.03417.38
5.6.30.0090.04317.31
5.6.20.0110.03217.30
5.6.10.0100.02517.50
5.6.00.0050.02517.30
5.5.380.0110.03715.82
5.5.370.0080.04315.87
5.5.360.0020.02715.87
5.5.350.0050.04615.86
5.5.340.0050.02216.10
5.5.330.0070.03716.04
5.5.320.0080.03516.15
5.5.310.0080.04016.02
5.5.300.0090.03916.15
5.5.290.0070.03216.16
5.5.280.0040.03516.03
5.5.270.0050.03816.19
5.5.260.0070.02516.07
5.5.250.0100.02716.00
5.5.240.0050.02115.73
5.5.230.0050.04015.73
5.5.220.0050.02215.75
5.5.210.0050.04315.73
5.5.200.0040.03415.76
5.5.190.0100.03715.74
5.5.180.0030.02815.71
5.5.170.0050.00511.18
5.5.160.0060.02415.74
5.5.150.0080.04515.82
5.5.140.0080.04215.90
5.5.130.0030.04515.85
5.5.120.0030.04315.84
5.5.110.0080.02315.82
5.5.100.0030.03715.86
5.5.90.0070.03915.85
5.5.80.0030.04115.64
5.5.70.0050.04015.76
5.5.60.0070.04115.79
5.5.50.0070.03815.67
5.5.40.0000.04015.74
5.5.30.0030.02415.77
5.5.20.0050.03715.78
5.5.10.0030.02215.76
5.5.00.0020.02715.62
5.4.450.0030.02715.32
5.4.440.0020.02815.41
5.4.430.0050.02515.31
5.4.420.0090.04215.45
5.4.410.0060.02115.47
5.4.400.0030.03015.16
5.4.390.0040.01915.16
5.4.380.0050.02315.22
5.4.370.0000.02515.15
5.4.360.0050.03615.07
5.4.350.0120.02315.08
5.4.340.0070.01915.12
5.4.330.0050.00511.18
5.4.320.0100.03815.09
5.4.310.0070.03715.21
5.4.300.0030.04315.10
5.4.290.0030.02515.05
5.4.280.0050.03715.20
5.4.270.0020.03015.19
5.4.260.0030.04415.15
5.4.250.0080.03415.14
5.4.240.0050.01815.17
5.4.230.0070.04015.04
5.4.220.0050.01815.06
5.4.210.0060.04315.16
5.4.200.0050.02015.22
5.4.190.0030.04415.16
5.4.180.0020.02615.30
5.4.170.0080.04015.05
5.4.160.0070.04015.17
5.4.150.0060.04015.14
5.4.140.0050.03413.94
5.4.130.0040.02113.82
5.4.120.0070.04013.85
5.4.110.0030.04413.90
5.4.100.0020.02713.82
5.4.90.0000.02613.89
5.4.80.0080.03613.96
5.4.70.0050.03813.82
5.4.60.0030.02313.96
5.4.50.0060.04013.72
5.4.40.0000.04013.86
5.4.30.0100.03513.81
5.4.20.0060.02313.85
5.4.10.0070.02213.79
5.4.00.0050.04213.56
5.3.290.0060.04413.00
5.3.280.0020.04212.96
5.3.270.0060.02212.97
5.3.260.0050.04212.90
5.3.250.0090.03112.93
5.3.240.0050.04512.91
5.3.230.0080.04312.86
5.3.220.0040.03312.95
5.3.210.0090.03712.93
5.3.200.0020.04312.84
5.3.190.0080.04012.87
5.3.180.0090.03812.89
5.3.170.0050.03012.91
5.3.160.0020.04412.87
5.3.150.0070.04112.94
5.3.140.0070.02712.94
5.3.130.0050.02212.87
5.3.120.0070.01912.89
5.3.110.0070.04512.90
5.3.100.0050.04412.62
5.3.90.0080.03312.59
5.3.80.0100.02512.68
5.3.70.0030.03812.57
5.3.60.0060.04112.59
5.3.50.0080.02112.58
5.3.40.0070.03912.57
5.3.30.0050.04112.53
5.3.20.0090.03412.53
5.3.10.0080.03812.53
5.3.00.0040.02312.53
5.2.170.0060.03112.53
5.2.160.0090.01512.53
5.2.150.0050.03712.53
5.2.140.0080.03412.53
5.2.130.0070.01812.53
5.2.120.0110.03112.53
5.2.110.0060.03012.53
5.2.100.0040.01712.53
5.2.90.0050.03412.53
5.2.80.0010.03812.53
5.2.70.0050.03412.53
5.2.60.0070.03212.53
5.2.50.0020.03512.53
5.2.40.0090.01612.53
5.2.30.0040.03512.53
5.2.20.0110.01712.53
5.2.10.0060.02612.53
5.2.00.0060.01612.53
5.1.60.0070.03012.53
5.1.50.0060.02812.53
5.1.40.0080.02712.53
5.1.30.0080.03312.53
5.1.20.0030.01812.53
5.1.10.0070.03112.53
5.1.00.0030.03012.53
5.0.50.0030.02712.53
5.0.40.0040.01212.53
5.0.30.0020.03212.53
5.0.20.0070.02012.53
5.0.10.0030.01612.53
5.0.00.0000.02612.53
4.4.90.0060.01812.53
4.4.80.0050.01312.53
4.4.70.0040.02012.53
4.4.60.0030.01212.53
4.4.50.0020.02212.53
4.4.40.0070.02512.53
4.4.30.0030.01812.53
4.4.20.0040.00912.53
4.4.10.0020.02212.53
4.4.00.0050.02212.53
4.3.110.0030.01212.53
4.3.100.0020.01012.53
4.3.90.0030.01612.53
4.3.80.0020.01912.53
4.3.70.0020.01512.53
4.3.60.0040.01012.53
4.3.50.0030.01512.53
4.3.40.0020.01512.53
4.3.30.0030.01112.53
4.3.20.0000.01512.53
4.3.10.0030.00812.53
4.3.00.0020.01012.53

preferences:
47.15 ms | 401 KiB | 5 Q