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; $temp = $inbetween / $i[0] / $i[0] / $i[1]; $tempDays = $temp % 365; 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($temp / 365.25); $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, 51417392000); 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.0150.00318.55
8.3.50.0250.00721.13
8.3.40.0070.00719.30
8.3.30.0100.00320.29
8.3.20.0070.00020.34
8.3.10.0040.00421.83
8.3.00.0080.00022.46
8.2.180.0110.01116.75
8.2.170.0100.00722.96
8.2.160.0100.00322.25
8.2.150.0060.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0070.00021.04
8.2.110.0030.00721.23
8.2.100.0120.00318.16
8.2.90.0000.00819.30
8.2.80.0000.00819.45
8.2.70.0040.00417.96
8.2.60.0100.00018.29
8.2.50.0040.00418.13
8.2.40.0040.00418.40
8.2.30.0020.00519.61
8.2.20.0050.00318.06
8.2.10.0030.00518.18
8.2.00.0040.00418.18
8.1.280.0110.00425.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0090.00024.09
8.1.230.0000.01019.24
8.1.220.0080.00017.80
8.1.210.0060.00318.77
8.1.200.0030.00717.85
8.1.190.0090.00017.88
8.1.180.0040.00418.10
8.1.170.0080.00018.96
8.1.160.0000.00718.98
8.1.150.0000.00818.92
8.1.140.0060.00317.74
8.1.130.0070.00018.07
8.1.120.0030.00517.82
8.1.110.0000.00717.79
8.1.100.0080.00017.86
8.1.90.0040.00417.79
8.1.80.0030.00517.84
8.1.70.0030.00317.72
8.1.60.0000.00917.74
8.1.50.0000.00817.77
8.1.40.0000.00817.80
8.1.30.0030.00517.95
8.1.20.0030.00518.02
8.1.10.0000.00817.80
8.1.00.0040.00417.88
8.0.300.0080.00018.90
8.0.290.0040.00417.43
8.0.280.0030.00318.71
8.0.270.0040.00417.46
8.0.260.0000.00717.24
8.0.250.0030.00317.39
8.0.240.0000.00817.41
8.0.230.0070.00017.42
8.0.220.0000.00717.36
8.0.210.0070.00017.36
8.0.200.0030.00317.27
8.0.190.0070.00017.32
8.0.180.0000.00817.27
8.0.170.0000.00917.28
8.0.160.0000.00717.29
8.0.150.0070.00017.28
8.0.140.0000.00817.28
8.0.130.0060.00013.62
8.0.120.0000.00717.34
8.0.110.0000.00717.21
8.0.100.0000.00817.20
8.0.90.0080.00017.28
8.0.80.0100.01317.26
8.0.70.0030.00517.33
8.0.60.0040.00417.31
8.0.50.0040.00417.30
8.0.30.0120.01017.57
8.0.20.0060.01317.51
8.0.10.0040.00417.43
8.0.00.0110.00917.24
7.4.330.0000.00516.89
7.4.320.0030.00316.87
7.4.300.0000.00716.84
7.4.290.0000.00816.84
7.4.280.0040.00416.88
7.4.270.0030.00316.82
7.4.260.0000.00513.52
7.4.250.0040.00416.83
7.4.240.0040.00416.90
7.4.230.0040.00416.94
7.4.220.0100.00716.87
7.4.210.0080.00916.78
7.4.200.0000.00716.89
7.4.190.0070.00016.77
7.4.160.0030.01316.80
7.4.150.0080.00817.40
7.4.140.0070.01017.86
7.4.130.0070.01016.87
7.4.120.0040.01416.88
7.4.110.0100.00716.95
7.4.100.0110.00616.95
7.4.90.0160.00316.89
7.4.80.0070.01019.39
7.4.70.0120.00816.96
7.4.60.0120.00616.77
7.4.50.0060.00316.87
7.4.40.0080.00822.77
7.4.30.0120.00616.93
7.4.00.0030.01315.27
7.3.330.0000.00513.67
7.3.320.0000.00513.47
7.3.310.0000.00716.56
7.3.300.0000.00816.61
7.3.290.0100.00316.61
7.3.280.0090.00916.62
7.3.270.0040.01417.40
7.3.260.0190.00318.24
7.3.250.0130.00516.81
7.3.240.0030.01316.86
7.3.230.0120.00616.95
7.3.210.0030.01316.91
7.3.200.0100.00719.39
7.3.190.0060.01616.79
7.3.180.0090.00917.02
7.3.170.0000.01616.61
7.3.160.0070.01016.95
7.3.120.0100.00715.18
7.3.110.0110.00714.84
7.3.100.0060.01315.19
7.3.90.0030.00815.25
7.3.80.0150.00015.20
7.3.70.0070.00315.16
7.3.60.0060.01015.04
7.3.50.0030.00615.01
7.3.40.0030.00914.88
7.3.30.0000.01415.18
7.3.20.0090.00316.98
7.3.10.0090.00316.96
7.3.00.0060.00317.05
7.2.330.0120.00917.14
7.2.320.0170.00717.16
7.2.310.0110.00817.13
7.2.300.0040.01216.97
7.2.290.0120.00617.14
7.2.250.0030.01315.25
7.2.240.0040.01515.49
7.2.230.0000.01315.21
7.2.220.0060.00815.36
7.2.210.0030.01515.37
7.2.200.0040.00715.15
7.2.190.0030.01015.23
7.2.180.0070.01015.29
7.2.170.0130.00615.45
7.2.160.0070.01015.15
7.2.150.0000.01517.20
7.2.140.0090.00617.43
7.2.130.0080.00317.27
7.2.120.0030.00916.89
7.2.110.0000.01216.92
7.2.100.0030.01317.25
7.2.90.0030.00717.21
7.2.80.0100.00317.27
7.2.70.0100.00717.18
7.2.60.0090.00517.11
7.2.50.0100.00317.25
7.2.40.0030.01017.25
7.2.30.0070.00717.27
7.2.20.0000.01317.22
7.2.10.0070.00717.09
7.2.00.0060.00818.44
7.1.330.0070.01015.95
7.1.320.0070.00716.28
7.1.310.0070.00316.03
7.1.300.0070.00716.10
7.1.290.0130.00316.04
7.1.280.0040.00816.06
7.1.270.0040.00716.05
7.1.260.0090.00616.18
7.1.250.0060.00916.12
7.1.240.0080.00416.07
7.1.230.0000.01216.12
7.1.220.0090.00616.15
7.1.210.0030.01515.91
7.1.200.0060.00815.99
7.1.190.0060.00915.87
7.1.180.0030.01216.07
7.1.170.0000.01715.79
7.1.160.0040.00715.95
7.1.150.0000.01216.07
7.1.140.0040.01116.13
7.1.130.0040.00815.75
7.1.120.0070.00316.11
7.1.110.0100.00315.98
7.1.100.0050.00717.19
7.1.90.0110.00316.25
7.1.80.0040.01115.89
7.1.70.0030.01316.81
7.1.60.0110.00917.69
7.1.50.0060.01216.51
7.1.40.0030.00715.87
7.1.30.0030.01016.07
7.1.20.0090.00616.15
7.1.10.0030.01316.02
7.1.00.0040.04819.19
7.0.330.0070.00415.66
7.0.320.0090.00915.35
7.0.310.0060.00615.61
7.0.300.0070.00715.58
7.0.290.0090.00015.71
7.0.280.0060.00615.62
7.0.270.0040.01115.63
7.0.260.0050.00515.73
7.0.250.0090.00615.54
7.0.240.0030.01215.75
7.0.230.0060.00615.57
7.0.220.0040.00815.31
7.0.210.0090.00415.67
7.0.200.0040.00716.35
7.0.190.0100.00015.64
7.0.180.0030.01315.69
7.0.170.0040.00715.61
7.0.160.0090.00615.72
7.0.150.0060.00615.74
7.0.140.0070.03618.82
7.0.130.0090.00615.77
7.0.120.0000.01015.68
7.0.110.0040.01215.69
7.0.100.0080.00315.59
7.0.90.0070.00815.68
7.0.80.0070.03617.86
7.0.70.0100.04317.84
7.0.60.0100.03917.90
7.0.50.0180.02617.98
7.0.40.0070.03517.51
7.0.30.0020.03217.40
7.0.20.0120.02217.51
7.0.10.0060.02717.44
7.0.00.0030.02417.40
5.6.400.0100.00614.84
5.6.390.0090.00314.84
5.6.380.0060.00914.97
5.6.370.0030.01014.84
5.6.360.0030.00714.84
5.6.350.0040.01114.84
5.6.340.0030.00914.84
5.6.330.0040.01114.86
5.6.320.0090.00614.84
5.6.310.0070.00714.84
5.6.300.0060.00814.84
5.6.290.0050.00514.84
5.6.280.0020.04217.96
5.6.270.0050.00514.91
5.6.260.0110.00714.84
5.6.250.0040.01214.84
5.6.240.0040.01014.84
5.6.230.0080.02617.70
5.6.220.0040.03417.77
5.6.210.0030.04517.73
5.6.200.0060.02618.00
5.6.190.0040.03418.00
5.6.180.0120.02817.90
5.6.170.0070.02717.93
5.6.160.0050.02318.00
5.6.150.0080.03617.88
5.6.140.0080.03218.01
5.6.130.0110.04317.93
5.6.120.0050.04817.94
5.6.110.0020.04217.97
5.6.100.0060.04317.94
5.6.90.0050.04017.93
5.6.80.0110.04217.65
5.6.70.0100.04417.64
5.6.60.0060.04517.60
5.6.50.0000.04117.69
5.6.40.0080.04717.57
5.6.30.0100.02317.66
5.6.20.0060.03917.67
5.6.10.0030.02517.65
5.6.00.0070.04017.62
5.5.380.0030.00614.84
5.5.370.0080.03017.69
5.5.360.0070.04717.60
5.5.350.0080.02517.64
5.5.340.0090.03317.86
5.5.330.0060.03317.87
5.5.320.0050.02717.86
5.5.310.0070.03017.84
5.5.300.0150.03517.87
5.5.290.0120.03817.89
5.5.280.0080.03317.89
5.5.270.0100.03117.84
5.5.260.0030.02917.82
5.5.250.0030.04917.79
5.5.240.0120.02517.55
5.5.230.0050.04717.43
5.5.220.0140.02717.55
5.5.210.0080.04017.59
5.5.200.0030.04317.54
5.5.190.0060.04617.54
5.5.180.0070.02617.55
5.5.170.0110.00414.84
5.5.160.0050.04017.55
5.5.150.0050.03917.56
5.5.140.0050.04217.53
5.5.130.0020.02917.50
5.5.120.0080.04917.54
5.5.110.0030.02517.52
5.5.100.0090.02017.49
5.5.90.0000.02717.49
5.5.80.0030.03517.51
5.5.70.0070.02217.43
5.5.60.0030.02217.46
5.5.50.0050.02317.47
5.5.40.0020.02117.47
5.5.30.0020.02517.43
5.5.20.0070.02017.46
5.5.10.0050.02017.44
5.5.00.0020.02117.45
5.4.450.0050.04517.18
5.4.440.0110.03817.17
5.4.430.0050.04417.16
5.4.420.0060.02217.06
5.4.410.0050.03617.08
5.4.400.0110.03517.01
5.4.390.0030.02916.97
5.4.380.0050.04016.97
5.4.370.0060.02817.01
5.4.360.0100.03616.98
5.4.350.0070.04216.98
5.4.340.0030.04316.98
5.4.330.0030.01014.84
5.4.320.0090.02316.98
5.4.310.0110.03216.87
5.4.300.0060.03017.01
5.4.290.0010.02517.00
5.4.280.0060.02116.98
5.4.270.0060.02517.04
5.4.260.0040.02916.98
5.4.250.0050.02416.98
5.4.240.0060.02017.03
5.4.230.0020.02416.89
5.4.220.0070.01817.00
5.4.210.0080.01716.96
5.4.200.0080.01616.98
5.4.190.0050.02316.87
5.4.180.0000.02316.87
5.4.170.0030.02116.98
5.4.160.0070.01817.03
5.4.150.0030.03016.93
5.4.140.0060.01415.67
5.4.130.0050.02115.65
5.4.120.0070.01915.61
5.4.110.0080.02015.68
5.4.100.0060.02115.65
5.4.90.0020.03515.64
5.4.80.0050.01915.69
5.4.70.0030.02315.67
5.4.60.0040.02015.64
5.4.50.0090.01615.63
5.4.40.0050.02015.69
5.4.30.0030.02115.65
5.4.20.0050.01715.66
5.4.10.0070.01715.65
5.4.00.0020.03015.25
5.3.290.0020.04514.82
5.3.280.0030.01814.73
5.3.270.0030.02214.70
5.3.260.0030.02114.75
5.3.250.0040.04114.77
5.3.240.0020.02214.77
5.3.230.0050.02314.78
5.3.220.0040.02114.75
5.3.210.0030.02014.73
5.3.200.0020.03114.75
5.3.190.0030.01914.73
5.3.180.0030.03014.73
5.3.170.0000.02514.69
5.3.160.0040.01814.77
5.3.150.0050.01714.74
5.3.140.0100.01714.71
5.3.130.0020.02014.73
5.3.120.0000.02414.65
5.3.110.0020.02514.70
5.3.100.0040.01714.46
5.3.90.0070.01814.47
5.3.80.0050.02114.38
5.3.70.0050.02014.40
5.3.60.0050.02014.45
5.3.50.0030.02114.37
5.3.40.0050.02014.48
5.3.30.0020.02314.41
5.3.20.0050.02014.32
5.3.10.0020.02314.29
5.3.00.0050.01914.20
5.2.170.0000.03311.19
5.2.160.0000.02711.29
5.2.150.0030.03011.09
5.2.140.0000.04311.14
5.2.130.0000.03011.13
5.2.120.0030.02311.15
5.2.110.0030.02711.18
5.2.100.0000.03011.25
5.2.90.0000.03311.26
5.2.80.0000.03011.00
5.2.70.0000.03011.01
5.2.60.0070.04311.21
5.2.50.0100.05311.18
5.2.40.0070.05711.16
5.2.30.0030.05311.11
5.2.20.0070.06310.87
5.2.10.0070.06010.83
5.2.00.0070.05310.86
5.1.60.0030.0539.90
5.1.50.0030.04310.02
5.1.40.0070.05710.08
5.1.30.0130.04710.48
5.1.20.0030.04010.39
5.1.10.0070.04010.19
5.1.00.0000.0379.93
5.0.50.0030.0378.61
5.0.40.0030.0478.45
5.0.30.0070.0478.17
5.0.20.0000.0478.23
5.0.10.0000.0478.26
5.0.00.0030.0638.25
4.4.90.0030.0237.15
4.4.80.0030.0337.15
4.4.70.0030.0337.15
4.4.60.0030.0337.15
4.4.50.0070.0307.15
4.4.40.0000.0577.15
4.4.30.0000.0277.15
4.4.20.0030.0377.15
4.4.10.0070.0337.15
4.4.00.0000.0437.15
4.3.110.0030.0307.15
4.3.100.0030.0207.15
4.3.90.0030.0277.15
4.3.80.0030.0337.15
4.3.70.0000.0237.15
4.3.60.0030.0307.15
4.3.50.0100.0407.15
4.3.40.0000.0507.15
4.3.30.0000.0377.15
4.3.20.0030.0237.15
4.3.10.0030.0307.15
4.3.00.0000.0307.15

preferences:
48.44 ms | 401 KiB | 5 Q