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 = 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, 1417395661); 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.0070.01018.81
8.3.50.0130.00721.27
8.3.40.0070.00719.03
8.3.30.0040.01120.42
8.3.20.0070.00020.37
8.3.10.0110.00422.17
8.3.00.0050.00322.58
8.2.180.0090.00917.00
8.2.170.0120.00622.96
8.2.160.0070.00722.38
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0070.00026.16
8.2.120.0040.00420.96
8.2.110.0130.00420.71
8.2.100.0080.00419.82
8.2.90.0040.00419.53
8.2.80.0060.00319.46
8.2.70.0000.00817.88
8.2.60.0040.00418.18
8.2.50.0000.00918.07
8.2.40.0040.00418.46
8.2.30.0080.00019.52
8.2.20.0080.00018.16
8.2.10.0040.00418.16
8.2.00.0000.00818.11
8.1.280.0090.00625.92
8.1.270.0040.00423.99
8.1.260.0090.00626.35
8.1.250.0000.00828.09
8.1.240.0060.00320.84
8.1.230.0040.00721.16
8.1.220.0040.00418.05
8.1.210.0040.00418.77
8.1.200.0060.00317.84
8.1.190.0030.00617.77
8.1.180.0000.00818.10
8.1.170.0000.00819.02
8.1.160.0040.00419.09
8.1.150.0040.00419.03
8.1.140.0030.00617.81
8.1.130.0000.00718.06
8.1.120.0040.00417.88
8.1.110.0040.00417.71
8.1.100.0060.00317.84
8.1.90.0040.00417.84
8.1.80.0000.00717.73
8.1.70.0030.00317.76
8.1.60.0070.00317.78
8.1.50.0030.00617.71
8.1.40.0040.00417.90
8.1.30.0000.00817.99
8.1.20.0060.00317.97
8.1.10.0000.00817.85
8.1.00.0000.00817.87
8.0.300.0050.00219.31
8.0.290.0060.00317.43
8.0.280.0050.00318.60
8.0.270.0030.00517.49
8.0.260.0000.00717.32
8.0.250.0070.00017.41
8.0.240.0050.00517.27
8.0.230.0040.00417.27
8.0.220.0030.00317.29
8.0.210.0000.00817.26
8.0.200.0030.00317.35
8.0.190.0000.00817.38
8.0.180.0000.00717.33
8.0.170.0040.00417.25
8.0.160.0040.00417.32
8.0.150.0030.00517.33
8.0.140.0060.00317.31
8.0.130.0060.00013.72
8.0.120.0000.00817.30
8.0.110.0040.00417.27
8.0.100.0040.00417.26
8.0.90.0030.00517.34
8.0.80.0060.01317.36
8.0.70.0050.00317.32
8.0.60.0030.00517.23
8.0.50.0040.00417.21
8.0.30.0130.00917.51
8.0.20.0070.01517.42
8.0.10.0000.00817.48
8.0.00.0130.00617.20
7.4.330.0000.00516.95
7.4.320.0000.00616.67
7.4.300.0000.00616.81
7.4.290.0070.00016.81
7.4.280.0050.00216.88
7.4.270.0030.00316.82
7.4.260.0060.00013.46
7.4.250.0080.00016.76
7.4.240.0030.00316.82
7.4.230.0000.00716.63
7.4.220.0100.00916.98
7.4.210.0070.00716.85
7.4.200.0070.00016.63
7.4.190.0030.00517.09
7.4.160.0100.01316.68
7.4.150.0170.00717.40
7.4.140.0100.01117.86
7.4.130.0090.01116.83
7.4.120.0070.01016.87
7.4.110.0120.00916.71
7.4.100.0130.01017.03
7.4.90.0030.01316.93
7.4.80.0100.01019.39
7.4.70.0060.01516.88
7.4.60.0130.01016.98
7.4.50.0030.00617.00
7.4.40.0000.01822.77
7.4.30.0100.01316.96
7.4.10.0060.01215.29
7.4.00.0090.00915.11
7.3.330.0060.00013.52
7.3.320.0000.00513.51
7.3.310.0030.00316.69
7.3.300.0030.00316.62
7.3.290.0070.01016.63
7.3.280.0040.01216.65
7.3.270.0070.01017.40
7.3.260.0140.00718.24
7.3.250.0080.01016.81
7.3.240.0070.01017.08
7.3.230.0150.01116.75
7.3.210.0140.00316.66
7.3.200.0070.01419.39
7.3.190.0110.01116.70
7.3.180.0100.00716.71
7.3.170.0080.00816.71
7.3.160.0060.01216.77
7.3.130.0090.00915.19
7.3.120.0060.00915.27
7.3.110.0130.00615.27
7.3.100.0000.01415.09
7.3.90.0110.00715.05
7.3.80.0060.00315.16
7.3.70.0100.00314.82
7.3.60.0000.01214.94
7.3.50.0070.00415.18
7.3.40.0040.01214.83
7.3.30.0000.00914.92
7.3.20.0030.01116.74
7.3.10.0070.00716.71
7.3.00.0070.00717.09
7.2.330.0090.00916.79
7.2.320.0120.01216.98
7.2.310.0080.01517.04
7.2.300.0110.00617.11
7.2.290.0110.00617.09
7.2.260.0090.00915.38
7.2.250.0070.01015.26
7.2.240.0060.00915.63
7.2.230.0070.01015.38
7.2.220.0030.01015.61
7.2.210.0060.00615.25
7.2.200.0120.00315.48
7.2.190.0140.00315.49
7.2.180.0060.00615.31
7.2.170.0110.00015.25
7.2.160.0090.00315.34
7.2.150.0070.00717.27
7.2.140.0060.00317.17
7.2.130.0070.00717.19
7.2.120.0060.00817.11
7.2.110.0100.00017.30
7.2.100.0000.01317.28
7.2.90.0030.01017.34
7.2.80.0030.01316.95
7.2.70.0060.00617.19
7.2.60.0060.00617.29
7.2.50.0000.01417.25
7.2.40.0060.00617.18
7.2.30.0060.01017.29
7.2.20.0130.00317.17
7.2.10.0030.00917.09
7.2.00.0050.01018.32
7.1.330.0040.00815.86
7.1.320.0100.00716.04
7.1.310.0040.00816.00
7.1.300.0000.01316.06
7.1.290.0030.00715.84
7.1.280.0070.00716.21
7.1.270.0090.00016.10
7.1.260.0100.00716.05
7.1.250.0140.00016.18
7.1.240.0000.00816.00
7.1.230.0070.00315.71
7.1.220.0000.01116.21
7.1.210.0040.00715.80
7.1.200.0030.00816.13
7.1.190.0050.00516.13
7.1.180.0040.01116.02
7.1.170.0060.00315.65
7.1.160.0000.01116.18
7.1.150.0030.01016.03
7.1.140.0000.01115.94
7.1.130.0120.00316.09
7.1.120.0000.01916.18
7.1.110.0020.01616.18
7.1.100.0040.00617.35
7.1.90.0070.00716.20
7.1.80.0080.00816.00
7.1.70.0070.00416.80
7.1.60.0080.00917.68
7.1.50.0050.01516.69
7.1.40.0130.00316.11
7.1.30.0070.01016.04
7.1.20.0030.00615.87
7.1.10.0040.00416.05
7.1.00.0030.03419.16
7.0.330.0060.00615.68
7.0.320.0070.00715.74
7.0.310.0000.01115.43
7.0.300.0040.00715.40
7.0.290.0030.01015.70
7.0.280.0000.01215.49
7.0.270.0090.00015.38
7.0.260.0000.01615.43
7.0.250.0060.00915.30
7.0.240.0080.00415.41
7.0.230.0000.01315.74
7.0.220.0000.01115.72
7.0.210.0000.01715.73
7.0.200.0030.00616.09
7.0.190.0060.00915.59
7.0.180.0070.00715.68
7.0.170.0070.00715.45
7.0.160.0050.00315.58
7.0.150.0070.00715.62
7.0.140.0080.03818.90
7.0.130.0040.00415.74
7.0.120.0000.00815.80
7.0.110.0000.01315.69
7.0.100.0030.04418.56
7.0.90.0100.01718.68
7.0.80.0080.04018.58
7.0.70.0030.03218.70
7.0.60.0040.04618.69
7.0.50.0030.04818.89
7.0.40.0030.04616.83
7.0.30.0080.03016.86
7.0.20.0040.04616.66
7.0.10.0050.04416.90
7.0.00.0070.02216.81
5.6.400.0040.01114.38
5.6.390.0030.00614.42
5.6.380.0000.00914.71
5.6.370.0000.00814.54
5.6.360.0100.00314.63
5.6.350.0000.01214.92
5.6.340.0060.01214.87
5.6.330.0030.01314.53
5.6.320.0000.01514.78
5.6.310.0040.00414.93
5.6.300.0070.00714.93
5.6.290.0040.01414.81
5.6.280.0060.03817.79
5.6.270.0070.00714.51
5.6.260.0000.01514.50
5.6.250.0070.03017.53
5.6.240.0060.03017.67
5.6.230.0080.04417.58
5.6.220.0030.04217.58
5.6.210.0140.03117.68
5.6.200.0030.02917.83
5.6.190.0060.04617.75
5.6.180.0040.04417.76
5.6.170.0050.04517.81
5.6.160.0060.03517.85
5.6.150.0050.02517.90
5.6.140.0080.02117.79
5.6.130.0070.02717.89
5.6.120.0020.02917.87
5.6.110.0040.02417.80
5.6.100.0040.02917.98
5.6.90.0050.02817.69
5.6.80.0120.01817.50
5.6.70.0050.02517.64
5.6.60.0050.02017.41
5.6.50.0040.02317.37
5.6.40.0000.02617.46
5.6.30.0030.02317.50
5.6.20.0060.02117.49
5.6.10.0000.03017.63
5.6.00.0020.02617.52
5.5.380.0040.04217.50
5.5.370.0040.03617.56
5.5.360.0090.04517.62
5.5.350.0080.04117.49
5.5.340.0100.04117.87
5.5.330.0060.03617.79
5.5.320.0090.04017.84
5.5.310.0070.02317.62
5.5.300.0050.02717.61
5.5.290.0080.01917.73
5.5.280.0080.02317.65
5.5.270.0000.03317.70
5.5.260.0030.02517.66
5.5.250.0030.02717.73
5.5.240.0080.01817.38
5.5.230.0030.02217.26
5.5.220.0020.02817.40
5.5.210.0030.02417.42
5.5.200.0070.02017.49
5.5.190.0050.01817.42
5.5.180.0010.02117.42
5.5.170.0000.01314.54
5.5.160.0040.02017.50
5.5.150.0030.03217.54
5.5.140.0050.02217.45
5.5.130.0020.02317.50
5.5.120.0050.02817.45
5.5.110.0070.02317.43
5.5.100.0020.02617.41
5.5.90.0020.02517.50
5.5.80.0050.02317.32
5.5.70.0050.02017.37
5.5.60.0040.02717.39
5.5.50.0080.01817.34
5.5.40.0030.02317.37
5.5.30.0060.02017.28
5.5.20.0020.02317.23
5.5.10.0020.02717.27
5.5.00.0050.01817.21
5.4.450.0030.02215.26
5.4.440.0020.02415.28
5.4.430.0000.02615.27
5.4.420.0030.02115.38
5.4.410.0020.02315.21
5.4.400.0030.02015.27
5.4.390.0050.01815.10
5.4.380.0040.03215.03
5.4.370.0050.01815.29
5.4.360.0060.01815.36
5.4.350.0010.02315.35
5.4.340.0020.02315.20
5.4.330.0030.01011.44
5.4.320.0030.02215.33
5.4.310.0050.02715.12
5.4.300.0000.02615.40
5.4.290.0020.03015.09
5.4.280.0060.01815.30
5.4.270.0040.02115.32
5.4.260.0000.02415.08
5.4.250.0070.02914.95
5.4.240.0020.02215.36
5.4.230.0020.02615.16
5.4.220.0050.02215.18
5.4.210.0050.02515.27
5.4.200.0000.03515.18
5.4.190.0070.02515.17
5.4.180.0050.01815.32
5.4.170.0020.02115.13
5.4.160.0030.02515.27
5.4.150.0080.01815.31
5.4.140.0080.03813.78
5.4.130.0110.03213.94
5.4.120.0030.03814.09
5.4.110.0040.02813.81
5.4.100.0050.03713.91
5.4.90.0050.04213.96
5.4.80.0080.03013.95
5.4.70.0080.03713.97
5.4.60.0050.03913.80
5.4.50.0030.03413.87
5.4.40.0030.04213.72
5.4.30.0070.03413.93
5.4.20.0050.03313.82
5.4.10.0020.02813.76
5.4.00.0020.03813.46
5.3.290.0030.02212.76
5.3.280.0030.03012.73
5.3.270.0040.02812.81
5.3.260.0000.02212.82
5.3.250.0030.02512.84
5.3.240.0030.02912.73
5.3.230.0030.02812.81
5.3.220.0070.02312.64
5.3.210.0050.04212.74
5.3.200.0020.04612.66
5.3.190.0070.03512.61
5.3.180.0000.04312.63
5.3.170.0050.04012.76
5.3.160.0010.04512.86
5.3.150.0040.04112.83
5.3.140.0040.04012.70
5.3.130.0000.02412.73
5.3.120.0070.03712.73
5.3.110.0080.03712.77
5.3.100.0020.03012.30
5.3.90.0060.03512.32
5.3.80.0040.03912.30
5.3.70.0040.03612.34
5.3.60.0050.04012.51
5.3.50.0070.03612.49
5.3.40.0020.02712.45
5.3.30.0030.03812.40
5.3.20.0030.03012.24
5.3.10.0030.03612.06
5.3.00.0020.04112.15
5.2.170.0030.06311.30
5.2.160.0000.05711.19
5.2.150.0000.06711.23
5.2.140.0030.05311.25
5.2.130.0000.06711.17
5.2.120.0030.06311.18
5.2.110.0070.05711.23
5.2.100.0070.05011.05
5.2.90.0000.06311.24
5.2.80.0030.05711.10
5.2.70.0000.03711.16
5.2.60.0000.06311.18
5.2.50.0030.05011.10
5.2.40.0030.03011.08
5.2.30.0000.07010.89
5.2.20.0030.05711.10
5.2.10.0000.04010.90
5.2.00.0070.04310.77
5.1.60.0000.05710.12
5.1.50.0000.04710.05
5.1.40.0030.05310.06
5.1.30.0070.05310.41
5.1.20.0030.06010.33
5.1.10.0030.05010.17
5.1.00.0030.04310.17
5.0.50.0000.0278.43
5.0.40.0030.0408.53
5.0.30.0000.0708.35
5.0.20.0000.0408.34
5.0.10.0030.0178.20
5.0.00.0030.0638.31
4.4.90.0000.0177.49
4.4.80.0000.0307.49
4.4.70.0000.0307.49
4.4.60.0000.0337.49
4.4.50.0000.0277.49
4.4.40.0000.0437.49
4.4.30.0000.0277.49
4.4.20.0030.0237.49
4.4.10.0000.0277.49
4.4.00.0030.0407.49
4.3.110.0000.0377.49
4.3.100.0000.0307.49
4.3.90.0070.0177.49
4.3.80.0000.0537.49
4.3.70.0030.0237.49
4.3.60.0000.0307.49
4.3.50.0070.0307.49
4.3.40.0000.0537.49
4.3.30.0000.0337.49
4.3.20.0030.0277.49
4.3.10.0000.0207.49
4.3.00.0030.0337.49

preferences:
46.17 ms | 401 KiB | 5 Q