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; $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 = round($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, 1451606400); 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.0140.00416.75
8.3.50.0080.01317.26
8.3.40.0110.00719.37
8.3.30.0110.00419.17
8.3.20.0080.00019.10
8.3.10.0040.00419.02
8.3.00.0050.00319.63
8.2.180.0110.01117.00
8.2.170.0130.00722.96
8.2.160.0090.00621.30
8.2.150.0080.00024.18
8.2.140.0100.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00320.98
8.2.110.0000.01020.95
8.2.100.0060.00618.09
8.2.90.0030.00619.72
8.2.80.0000.00819.42
8.2.70.0030.00617.88
8.2.60.0050.00318.18
8.2.50.0030.00618.07
8.2.40.0040.00718.27
8.2.30.0080.00018.41
8.2.20.0090.00018.15
8.2.10.0080.00018.11
8.2.00.0030.00518.16
8.1.280.0090.00625.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0040.00422.91
8.1.230.0070.00421.10
8.1.220.0000.00817.80
8.1.210.0030.00518.91
8.1.200.0030.00717.85
8.1.190.0040.00417.91
8.1.180.0040.00418.10
8.1.170.0040.00418.78
8.1.160.0050.00219.14
8.1.150.0030.00619.01
8.1.140.0030.00517.82
8.1.130.0000.00717.99
8.1.120.0000.00717.90
8.1.110.0050.00317.77
8.1.100.0040.00417.81
8.1.90.0040.00417.76
8.1.80.0040.00417.81
8.1.70.0000.00717.80
8.1.60.0080.00017.88
8.1.50.0030.00617.77
8.1.40.0080.00017.70
8.1.30.0040.00417.86
8.1.20.0040.00417.79
8.1.10.0090.00017.91
8.1.00.0030.00617.76
8.0.300.0000.00819.95
8.0.290.0040.00417.00
8.0.280.0000.00718.67
8.0.270.0050.00217.50
8.0.260.0040.00417.26
8.0.250.0030.00517.28
8.0.240.0040.00417.29
8.0.230.0030.00517.43
8.0.220.0030.00317.29
8.0.210.0000.00717.35
8.0.200.0040.00417.38
8.0.190.0030.00617.39
8.0.180.0000.00717.38
8.0.170.0090.00017.34
8.0.160.0000.00717.28
8.0.150.0030.00517.26
8.0.140.0000.00817.27
8.0.130.0030.00313.69
8.0.120.0080.00017.29
8.0.110.0000.00817.34
8.0.100.0040.00417.39
8.0.90.0040.00417.19
8.0.80.0060.00917.33
8.0.70.0060.00317.24
8.0.60.0070.00017.19
8.0.50.0050.00317.19
8.0.30.0130.00717.43
8.0.20.0100.00717.50
8.0.10.0050.00317.33
8.0.00.0120.00617.02
7.4.330.0000.00513.32
7.4.320.0000.00616.68
7.4.300.0030.00316.71
7.4.290.0030.00616.71
7.4.280.0030.00516.89
7.4.270.0000.00716.83
7.4.260.0030.00313.54
7.4.250.0080.00016.80
7.4.240.0020.00516.79
7.4.230.0030.00316.91
7.4.220.0100.00716.76
7.4.210.0070.00816.87
7.4.200.0000.00716.93
7.4.190.0070.00016.72
7.4.160.0170.00717.09
7.4.150.0180.00317.07
7.4.140.0070.01416.84
7.4.130.0060.01217.07
7.4.120.0090.00916.83
7.4.110.0060.01616.94
7.4.100.0040.01416.84
7.4.90.0120.01116.88
7.4.80.0120.00419.39
7.4.70.0070.01016.79
7.4.60.0130.00416.96
7.4.50.0100.00317.04
7.4.40.0060.01216.82
7.4.30.0030.01516.86
7.4.10.0000.02015.36
7.4.00.0030.01015.35
7.3.330.0000.00613.61
7.3.320.0030.00313.61
7.3.310.0000.00816.71
7.3.300.0000.00716.51
7.3.290.0090.00616.58
7.3.280.0110.00816.67
7.3.270.0060.01116.82
7.3.260.0100.00716.77
7.3.250.0220.01916.81
7.3.240.0040.01216.85
7.3.230.0050.01416.69
7.3.210.0110.00816.91
7.3.200.0030.01516.71
7.3.190.0120.00616.77
7.3.180.0080.00817.01
7.3.170.0090.00916.85
7.3.160.0130.00316.78
7.3.130.0030.01415.30
7.3.120.0000.01515.16
7.3.110.0090.00914.99
7.3.100.0070.00715.07
7.3.90.0060.00915.10
7.3.80.0030.00914.96
7.3.70.0050.00314.82
7.3.60.0070.00715.00
7.3.50.0060.00615.02
7.3.40.0000.01115.02
7.3.30.0060.00315.25
7.3.20.0070.00717.02
7.3.10.0060.00916.90
7.3.00.0110.00516.65
7.2.330.0090.00916.85
7.2.320.0070.01416.86
7.2.310.0060.01316.90
7.2.300.0110.00817.02
7.2.290.0120.00317.06
7.2.260.0080.01115.10
7.2.250.0080.00815.25
7.2.240.0110.00315.55
7.2.230.0090.00615.28
7.2.220.0060.01215.30
7.2.210.0100.00315.57
7.2.200.0080.00615.34
7.2.190.0030.01315.39
7.2.180.0060.00615.15
7.2.170.0060.01215.33
7.2.160.0040.01115.25
7.2.150.0100.00317.20
7.2.140.0100.00017.34
7.2.130.0080.00817.17
7.2.120.0090.00717.01
7.2.110.0100.00516.97
7.2.100.0090.00516.91
7.2.90.0100.00716.95
7.2.80.0100.00617.19
7.2.70.0040.01116.94
7.2.60.0070.00817.07
7.2.50.0150.00816.97
7.2.40.0070.00516.94
7.2.30.0080.00617.17
7.2.20.0120.00316.96
7.2.10.0050.01017.08
7.2.00.0070.00717.18
7.1.330.0040.00815.91
7.1.320.0110.00016.02
7.1.310.0050.00315.93
7.1.300.0030.00616.07
7.1.290.0140.00015.80
7.1.280.0030.01216.10
7.1.270.0030.00615.99
7.1.260.0040.00816.13
7.1.250.0070.00815.88
7.1.240.0100.00416.03
7.1.230.0050.00916.02
7.1.220.0100.00416.02
7.1.210.0070.00615.93
7.1.200.0100.00815.89
7.1.190.0100.00515.94
7.1.180.0130.00015.96
7.1.170.0040.00916.02
7.1.160.0090.00515.90
7.1.150.0030.01115.84
7.1.140.0110.00615.94
7.1.130.0070.00715.79
7.1.120.0050.00815.89
7.1.110.0060.00815.85
7.1.100.0070.00615.77
7.1.90.0020.01415.84
7.1.80.0090.00716.03
7.1.70.0020.00916.51
7.1.60.0100.00917.05
7.1.50.0090.00916.39
7.1.40.0070.00915.91
7.1.30.0060.00616.07
7.1.20.0120.00515.84
7.1.10.0060.00715.99
7.1.00.0080.03018.04
7.0.330.0050.01015.39
7.0.320.0060.00715.28
7.0.310.0050.00815.40
7.0.300.0080.00615.51
7.0.290.0060.00615.37
7.0.280.0040.01015.21
7.0.270.0070.00815.37
7.0.260.0060.00815.36
7.0.250.0100.00315.54
7.0.240.0080.00815.55
7.0.230.0060.00615.52
7.0.220.0070.00915.35
7.0.210.0050.00815.51
7.0.200.0040.00815.88
7.0.190.0050.01015.56
7.0.180.0090.00315.59
7.0.170.0060.00915.59
7.0.160.0030.00915.61
7.0.150.0060.00815.35
7.0.140.0080.02817.72
7.0.130.0060.01315.56
7.0.120.0080.01917.58
7.0.110.0050.00615.45
7.0.100.0110.02816.99
7.0.90.0080.02917.03
7.0.80.0060.02017.00
7.0.70.0090.02717.02
7.0.60.0070.03117.06
7.0.50.0120.02217.09
7.0.40.0110.02915.69
7.0.30.0010.03515.77
7.0.20.0050.03215.75
7.0.10.0080.02015.67
7.0.00.0040.03215.62
5.6.400.0080.00314.54
5.6.390.0000.01814.89
5.6.380.0030.01114.47
5.6.370.0060.00814.57
5.6.360.0020.01214.42
5.6.350.0020.01114.77
5.6.340.0080.00414.53
5.6.330.0020.00914.63
5.6.320.0020.01014.57
5.6.310.0030.00614.57
5.6.300.0030.00914.59
5.6.290.0030.01214.64
5.6.280.0030.03316.72
5.6.270.0050.00914.64
5.6.260.0070.00714.78
5.6.250.0070.01816.70
5.6.240.0060.03716.71
5.6.230.0070.03216.59
5.6.220.0050.01816.72
5.6.210.0010.02116.50
5.6.200.0050.03216.75
5.6.190.0080.03116.73
5.6.180.0090.02616.71
5.6.170.0040.03316.73
5.6.160.0020.03616.70
5.6.150.0060.03316.76
5.6.140.0070.03216.67
5.6.130.0080.02816.82
5.6.120.0030.02516.71
5.6.110.0080.02816.75
5.6.100.0070.02716.71
5.6.90.0080.03316.67
5.6.80.0050.03216.41
5.6.70.0030.02516.44
5.6.60.0130.02316.50
5.6.50.0060.03116.59
5.6.40.0070.02216.64
5.6.30.0090.03016.38
5.6.20.0080.03016.59
5.6.10.0080.02916.51
5.6.00.0070.03116.50
5.5.380.0070.02915.51
5.5.370.0060.03215.54
5.5.360.0080.02715.55
5.5.350.0090.02615.43
5.5.340.0120.02715.68
5.5.330.0070.02615.55
5.5.320.0040.03215.69
5.5.310.0040.03015.66
5.5.300.0040.02415.72
5.5.290.0060.02315.48
5.5.280.0060.02015.57
5.5.270.0050.02815.50
5.5.260.0030.03615.58
5.5.250.0040.03215.60
5.5.240.0010.02415.20
5.5.230.0030.03015.42
5.5.220.0040.03015.31
5.5.210.0090.03015.27
5.5.200.0040.03315.36
5.5.190.0030.02115.31
5.5.180.0040.02015.36
5.5.170.0090.00512.90
5.5.160.0020.02315.29
5.5.150.0030.02115.37
5.5.140.0070.03115.34
5.5.130.0060.02415.34
5.5.120.0060.02015.29
5.5.110.0050.01815.22
5.5.100.0060.02715.26
5.5.90.0090.02815.19
5.5.80.0070.03115.38
5.5.70.0070.02815.30
5.5.60.0040.02615.43
5.5.50.0040.03015.35
5.5.40.0110.01615.34
5.5.30.0070.02815.35
5.5.20.0040.02915.31
5.5.10.0060.02415.20
5.5.00.0030.03515.22
5.4.450.0080.02913.91
5.4.440.0060.02914.02
5.4.430.0040.03313.97
5.4.420.0100.02713.85
5.4.410.0060.03214.04
5.4.400.0090.01513.96
5.4.390.0040.03313.87
5.4.380.0020.02414.05
5.4.370.0000.03313.88
5.4.360.0070.01914.02
5.4.350.0090.02113.88
5.4.340.0040.03113.79
5.4.330.0040.00611.17
5.4.320.0080.02613.94
5.4.310.0040.03213.74
5.4.300.0060.03013.94
5.4.290.0000.03213.85
5.4.280.0020.02713.88
5.4.270.0070.01813.91
5.4.260.0030.02213.97
5.4.250.0020.02513.77
5.4.240.0060.02014.00
5.4.230.0040.02313.93
5.4.220.0110.01813.82
5.4.210.0070.01713.86
5.4.200.0070.02413.91
5.4.190.0080.02313.85
5.4.180.0040.03013.79
5.4.170.0090.02013.75
5.4.160.0050.02013.83
5.4.150.0090.01813.79
5.4.140.0060.02813.03
5.4.130.0050.01713.10
5.4.120.0070.02712.85
5.4.110.0060.01812.93
5.4.100.0030.03013.11
5.4.90.0080.02812.95
5.4.80.0020.03313.07
5.4.70.0100.02313.11
5.4.60.0070.02813.15
5.4.50.0050.02612.97
5.4.40.0030.03012.87
5.4.30.0090.02313.00
5.4.20.0050.02113.05
5.4.10.0080.02113.06
5.4.00.0030.02912.93
5.3.290.0010.02912.07
5.3.280.0050.02912.14
5.3.270.0030.01912.11
5.3.260.0050.02312.18
5.3.250.0040.01812.14
5.3.240.0050.02512.15
5.3.230.0060.02112.08
5.3.220.0080.02412.11
5.3.210.0100.02411.99
5.3.200.0130.02012.01
5.3.190.0110.02112.03
5.3.180.0090.02712.08
5.3.170.0070.02412.18
5.3.160.0040.02812.17
5.3.150.0040.02212.17
5.3.140.0040.02011.95
5.3.130.0050.02812.18
5.3.120.0060.03012.15
5.3.110.0060.02512.14
5.3.100.0060.02711.91
5.3.90.0060.02811.88
5.3.80.0050.02511.87
5.3.70.0090.02411.78
5.3.60.0050.01811.92
5.3.50.0030.03011.78
5.3.40.0060.02211.76
5.3.30.0050.02411.83
5.3.20.0060.02011.74
5.3.10.0050.02811.58
5.3.00.0050.02511.51
5.2.170.0130.02310.76
5.2.160.0100.02810.74
5.2.150.0050.03510.83
5.2.140.0030.03310.79
5.2.130.0040.01710.79
5.2.120.0050.02010.81
5.2.110.0100.02010.80
5.2.100.0020.02710.85
5.2.90.0070.03110.75
5.2.80.0050.03010.77
5.2.70.0070.02010.80
5.2.60.0020.02110.78
5.2.50.0060.01810.77
5.2.40.0080.01710.71
5.2.30.0000.01910.74
5.2.20.0090.01010.66
5.2.10.0020.02410.61
5.2.00.0050.01610.58
5.1.60.0020.01610.26
5.1.50.0020.01710.26
5.1.40.0080.01010.16
5.1.30.0050.01310.42
5.1.20.0060.01310.37
5.1.10.0050.01410.31
5.1.00.0070.02610.21
5.0.50.0010.0119.55
5.0.40.0050.0089.44
5.0.30.0070.0189.39
5.0.20.0030.0139.26
5.0.10.0050.0179.24
5.0.00.0050.0149.36
4.4.90.0000.0108.61
4.4.80.0000.0128.61
4.4.70.0020.0128.61
4.4.60.0020.0108.61
4.4.50.0000.0128.61
4.4.40.0020.0138.61
4.4.30.0020.0098.61
4.4.20.0030.0108.61
4.4.10.0020.0108.61
4.4.00.0000.0138.61
4.3.110.0030.0108.61
4.3.100.0000.0118.61
4.3.90.0060.0108.61
4.3.80.0010.0188.61
4.3.70.0000.0148.61
4.3.60.0020.0128.61
4.3.50.0020.0098.61
4.3.40.0060.0258.61
4.3.30.0070.0138.61
4.3.20.0030.0118.61
4.3.10.0020.0108.61
4.3.00.0040.0098.61

preferences:
40.5 ms | 401 KiB | 5 Q