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.70.0090.00617.13
8.3.60.0040.01118.68
8.3.50.0130.01021.27
8.3.40.0060.00919.04
8.3.30.0030.01020.34
8.3.20.0080.00020.47
8.3.10.0050.00322.03
8.3.00.0000.00822.50
8.2.180.0150.00417.00
8.2.170.0150.00022.96
8.2.160.0100.00322.38
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0070.00021.05
8.2.110.0140.00719.33
8.2.100.0060.00618.16
8.2.90.0050.00319.34
8.2.80.0000.00819.36
8.2.70.0030.00618.13
8.2.60.0030.00518.18
8.2.50.0060.00318.07
8.2.40.0030.00618.40
8.2.30.0000.00719.61
8.2.20.0040.00418.03
8.2.10.0050.00318.17
8.2.00.0040.00418.12
8.1.280.0120.00325.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.01022.12
8.1.230.0060.00621.09
8.1.220.0000.00817.91
8.1.210.0040.00418.77
8.1.200.0030.00617.50
8.1.190.0030.00617.91
8.1.180.0040.00418.10
8.1.170.0050.00318.87
8.1.160.0030.00619.17
8.1.150.0040.00418.99
8.1.140.0000.00717.71
8.1.130.0040.00418.12
8.1.120.0000.00717.88
8.1.110.0000.00717.72
8.1.100.0080.00017.81
8.1.90.0040.00417.80
8.1.80.0000.00717.83
8.1.70.0040.00417.74
8.1.60.0000.00917.82
8.1.50.0000.00817.79
8.1.40.0000.00817.85
8.1.30.0040.00417.88
8.1.20.0040.00417.80
8.1.10.0030.00617.80
8.1.00.0040.00417.89
8.0.300.0080.00018.77
8.0.290.0070.00017.54
8.0.280.0080.00018.68
8.0.270.0000.00717.47
8.0.260.0000.00717.29
8.0.250.0000.00717.41
8.0.240.0030.00617.29
8.0.230.0070.00017.37
8.0.220.0000.00817.24
8.0.210.0030.00317.23
8.0.200.0030.00317.40
8.0.190.0030.00617.30
8.0.180.0040.00417.34
8.0.170.0040.00417.36
8.0.160.0000.00717.30
8.0.150.0040.00417.23
8.0.140.0050.00517.27
8.0.130.0000.00613.68
8.0.120.0040.00417.18
8.0.110.0000.00717.30
8.0.100.0000.00717.13
8.0.90.0040.00417.27
8.0.80.0090.00617.37
8.0.70.0050.00317.21
8.0.60.0040.00417.11
8.0.50.0080.00017.18
8.0.30.0100.01017.43
8.0.20.0120.00617.55
8.0.10.0000.00717.41
8.0.00.0080.01317.30
7.4.330.0000.00516.82
7.4.320.0030.00316.96
7.4.300.0030.00316.81
7.4.290.0030.00316.92
7.4.280.0000.00716.90
7.4.270.0030.00316.92
7.4.260.0060.00013.42
7.4.250.0050.00316.88
7.4.240.0000.00716.84
7.4.230.0000.00816.95
7.4.220.0090.00916.86
7.4.210.0080.00716.94
7.4.200.0040.00416.81
7.4.190.0040.00416.78
7.4.160.0160.00316.80
7.4.150.0120.00617.40
7.4.140.0120.00517.86
7.4.130.0100.01116.91
7.4.120.0090.00916.82
7.4.110.0000.01716.68
7.4.100.0140.00316.80
7.4.90.0100.01016.85
7.4.80.0110.00919.39
7.4.70.0100.00716.83
7.4.60.0120.00916.88
7.4.50.0040.00416.79
7.4.40.0060.00922.77
7.4.30.0060.01216.84
7.4.10.0110.00715.23
7.4.00.0090.00915.35
7.3.330.0030.00313.64
7.3.320.0020.00213.46
7.3.310.0030.00316.61
7.3.300.0000.00716.67
7.3.290.0060.00816.66
7.3.280.0050.01216.63
7.3.270.0060.01217.40
7.3.260.0110.00818.24
7.3.250.0110.00616.66
7.3.240.0090.00916.49
7.3.230.0110.01416.93
7.3.210.0030.01516.82
7.3.200.0070.01519.39
7.3.190.0090.00916.94
7.3.180.0090.00916.76
7.3.170.0030.01316.73
7.3.160.0160.00016.93
7.3.130.0130.00715.28
7.3.120.0080.00915.10
7.3.110.0080.00915.09
7.3.100.0050.01215.05
7.3.90.0100.00715.05
7.3.80.0050.01015.18
7.3.70.0030.00915.15
7.3.60.0040.00815.10
7.3.50.0040.00615.07
7.3.40.0050.00715.19
7.3.30.0060.00615.07
7.3.20.0070.00616.83
7.3.10.0030.01117.01
7.3.00.0050.00816.84
7.2.330.0140.00517.13
7.2.320.0090.01016.93
7.2.310.0030.01516.70
7.2.300.0060.01017.11
7.2.290.0170.00017.12
7.2.260.0080.01215.21
7.2.250.0060.01115.54
7.2.240.0090.00915.16
7.2.230.0040.01215.35
7.2.220.0040.00915.47
7.2.210.0070.00915.47
7.2.200.0070.00715.35
7.2.190.0050.01115.31
7.2.180.0050.00915.25
7.2.170.0060.00815.29
7.2.160.0040.00415.23
7.2.150.0070.01017.14
7.2.140.0160.00317.36
7.2.130.0090.00517.02
7.2.120.0080.00817.18
7.2.110.0050.01017.03
7.2.100.0050.00817.24
7.2.90.0050.01217.19
7.2.80.0110.00617.10
7.2.70.0080.00817.14
7.2.60.0060.00817.17
7.2.50.0090.00717.24
7.2.40.0060.00717.32
7.2.30.0020.01117.03
7.2.20.0050.00717.07
7.2.10.0080.00817.30
7.2.00.0040.01018.09
7.1.330.0080.00516.02
7.1.320.0050.00616.15
7.1.310.0070.00616.09
7.1.300.0060.00816.00
7.1.290.0070.00716.01
7.1.280.0050.00816.05
7.1.270.0060.00515.96
7.1.260.0090.00616.08
7.1.250.0010.01316.15
7.1.240.0040.01116.18
7.1.230.0040.01116.07
7.1.220.0000.01215.80
7.1.210.0040.01116.00
7.1.200.0050.00915.93
7.1.190.0030.00916.13
7.1.180.0000.01116.20
7.1.170.0080.00815.71
7.1.160.0100.00316.20
7.1.150.0030.01015.94
7.1.140.0030.00616.10
7.1.130.0000.01415.73
7.1.120.0060.00916.02
7.1.110.0030.01016.20
7.1.100.0050.00817.26
7.1.90.0040.00816.03
7.1.80.0120.00316.06
7.1.70.0000.01216.61
7.1.60.0080.01017.51
7.1.50.0080.00916.54
7.1.40.0060.00915.86
7.1.30.0110.00416.06
7.1.20.0070.01015.95
7.1.10.0060.00616.11
7.1.00.0090.01619.28
7.0.330.0070.00315.69
7.0.320.0080.00315.57
7.0.310.0070.00415.27
7.0.300.0170.00015.54
7.0.290.0000.01615.58
7.0.280.0060.00615.35
7.0.270.0070.01015.60
7.0.260.0070.00715.58
7.0.250.0030.01015.65
7.0.240.0000.01015.55
7.0.230.0070.01015.57
7.0.220.0030.00915.74
7.0.210.0110.00015.67
7.0.200.0030.00716.22
7.0.190.0030.00915.51
7.0.180.0070.01015.69
7.0.170.0070.01015.56
7.0.160.0000.00815.35
7.0.150.0080.00815.15
7.0.140.0060.04018.75
7.0.130.0100.00315.75
7.0.120.0030.01515.72
7.0.110.0070.01015.76
7.0.100.0160.02817.83
7.0.90.0170.02517.75
7.0.80.0050.02817.67
7.0.70.0080.02817.78
7.0.60.0150.03517.73
7.0.50.0220.04617.91
7.0.40.0050.04716.87
7.0.30.0000.03416.80
7.0.20.0070.04316.90
7.0.10.0080.04316.94
7.0.00.0060.04616.82
5.6.400.0100.01014.41
5.6.390.0100.00014.85
5.6.380.0100.00714.65
5.6.370.0000.01214.81
5.6.360.0110.00414.53
5.6.350.0060.01214.37
5.6.340.0070.00714.52
5.6.330.0000.01414.66
5.6.320.0000.01014.68
5.6.310.0100.00314.37
5.6.300.0100.00314.85
5.6.290.0060.01214.69
5.6.280.0070.04017.78
5.6.270.0120.00314.63
5.6.260.0100.00714.53
5.6.250.0050.02717.72
5.6.240.0090.02017.50
5.6.230.0050.02417.75
5.6.220.0030.02517.55
5.6.210.0050.03017.63
5.6.200.0110.03217.87
5.6.190.0030.02917.73
5.6.180.0040.03917.83
5.6.170.0140.03617.87
5.6.160.0090.04717.98
5.6.150.0100.04217.84
5.6.140.0050.03017.86
5.6.130.0050.04717.78
5.6.120.0030.04217.83
5.6.110.0060.04617.89
5.6.100.0070.02917.79
5.6.90.0060.04617.95
5.6.80.0050.03117.45
5.6.70.0080.04417.49
5.6.60.0020.04617.49
5.6.50.0150.03217.55
5.6.40.0060.02817.51
5.6.30.0070.04217.57
5.6.20.0090.04417.36
5.6.10.0050.04317.49
5.6.00.0030.04017.41
5.5.380.0020.02617.49
5.5.370.0050.02717.54
5.5.360.0030.02517.38
5.5.350.0060.02317.36
5.5.340.0060.03917.65
5.5.330.0040.02717.87
5.5.320.0070.03217.59
5.5.310.0050.03017.75
5.5.300.0130.03717.82
5.5.290.0090.04017.87
5.5.280.0080.04217.66
5.5.270.0070.04817.67
5.5.260.0020.05217.66
5.5.250.0070.04117.49
5.5.240.0030.03317.32
5.5.230.0050.03417.41
5.5.220.0040.02917.41
5.5.210.0070.03717.43
5.5.200.0080.04617.23
5.5.190.0080.04317.25
5.5.180.0110.03917.22
5.5.170.0120.00314.48
5.5.160.0110.04217.24
5.5.150.0050.03417.41
5.5.140.0090.02317.22
5.5.130.0020.04917.29
5.5.120.0100.03217.27
5.5.110.0120.03717.29
5.5.100.0030.04417.39
5.5.90.0070.04517.44
5.5.80.0080.02117.12
5.5.70.0130.03217.22
5.5.60.0050.04217.38
5.5.50.0050.03717.15
5.5.40.0050.04517.18
5.5.30.0050.03217.25
5.5.20.0100.03817.39
5.5.10.0070.04217.18
5.5.00.0020.04317.15
5.4.450.0020.03115.20
5.4.440.0090.02215.25
5.4.430.0060.04015.32
5.4.420.0080.03615.35
5.4.410.0070.03515.37
5.4.400.0080.03915.22
5.4.390.0070.03514.99
5.4.380.0020.03515.22
5.4.370.0070.02215.23
5.4.360.0070.04915.32
5.4.350.0030.03615.15
5.4.340.0100.03115.21
5.4.330.0030.00611.32
5.4.320.0090.03815.14
5.4.310.0080.03815.19
5.4.300.0070.03515.04
5.4.290.0120.02715.23
5.4.280.0050.04215.10
5.4.270.0110.03715.04
5.4.260.0050.04415.11
5.4.250.0050.04115.24
5.4.240.0030.02615.33
5.4.230.0030.02915.25
5.4.220.0020.03815.27
5.4.210.0060.02115.11
5.4.200.0070.04215.03
5.4.190.0030.03815.01
5.4.180.0030.02615.13
5.4.170.0110.03815.09
5.4.160.0090.03915.15
5.4.150.0070.02314.96
5.4.140.0050.04313.85
5.4.130.0050.03913.81
5.4.120.0050.04113.76
5.4.110.0040.04013.93
5.4.100.0030.04413.92
5.4.90.0020.03413.88
5.4.80.0120.03113.75
5.4.70.0080.03613.75
5.4.60.0030.04213.72
5.4.50.0050.02713.87
5.4.40.0060.04213.77
5.4.30.0030.03213.90
5.4.20.0070.03713.85
5.4.10.0070.03713.91
5.4.00.0030.03613.60
5.3.290.0080.03612.90
5.3.280.0030.04112.78
5.3.270.0060.04112.65
5.3.260.0060.02012.79
5.3.250.0070.04212.82
5.3.240.0050.03512.81
5.3.230.0070.03912.71
5.3.220.0060.04112.67
5.3.210.0070.03512.68
5.3.200.0020.04012.71
5.3.190.0070.03512.56
5.3.180.0030.03412.75
5.3.170.0050.03712.64
5.3.160.0070.03812.65
5.3.150.0070.04012.69
5.3.140.0080.03612.63
5.3.130.0090.02812.80
5.3.120.0060.03512.74
5.3.110.0030.04212.71
5.3.100.0070.04012.52
5.3.90.0030.03912.48
5.3.80.0030.03812.42
5.3.70.0070.03812.40
5.3.60.0020.03712.25
5.3.50.0030.03812.38
5.3.40.0060.03512.45
5.3.30.0050.03212.49
5.3.20.0050.03912.14
5.3.10.0080.03612.19
5.3.00.0080.03812.24
5.2.170.0030.05711.27
5.2.160.0070.05711.09
5.2.150.0170.05711.15
5.2.140.0070.06711.15
5.2.130.0070.06011.23
5.2.120.0030.06311.04
5.2.110.0030.06311.12
5.2.100.0100.04311.11
5.2.90.0100.05710.98
5.2.80.0030.06311.22
5.2.70.0070.06011.12
5.2.60.0000.04310.94
5.2.50.0030.05011.04
5.2.40.0070.05711.10
5.2.30.0070.06011.00
5.2.20.0000.04710.89
5.2.10.0030.06010.74
5.2.00.0000.03710.69
5.1.60.0070.05010.30
5.1.50.0070.03310.30
5.1.40.0070.05310.30
5.1.30.0070.04010.34
5.1.20.0030.04310.51
5.1.10.0030.05310.30
5.1.00.0000.06010.30
5.0.50.0070.03710.30
5.0.40.0030.02310.30
5.0.30.0030.05710.30
5.0.20.0000.04310.30
5.0.10.0000.02710.30
5.0.00.0030.06010.30
4.4.90.0030.02310.30
4.4.80.0000.03710.30
4.4.70.0030.03310.30
4.4.60.0000.02310.30
4.4.50.0030.03310.30
4.4.40.0030.04710.30
4.4.30.0030.01310.30
4.4.20.0030.01710.30
4.4.10.0030.03710.30
4.4.00.0070.04310.30
4.3.110.0070.01310.30
4.3.100.0000.04010.30
4.3.90.0000.03710.30
4.3.80.0070.04710.30
4.3.70.0000.02310.30
4.3.60.0000.02310.30
4.3.50.0070.03010.30
4.3.40.0000.05310.30
4.3.30.0000.03010.30
4.3.20.0030.03710.30
4.3.10.0000.03010.30
4.3.00.0030.03310.30

preferences:
47.31 ms | 401 KiB | 5 Q