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, 2417395661); 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.0130.00616.75
8.3.60.0170.00318.53
8.3.50.0230.00821.39
8.3.40.0120.00319.17
8.3.30.0070.00720.39
8.3.20.0040.00420.38
8.3.10.0030.00722.05
8.3.00.0080.00022.52
8.2.180.0160.00316.61
8.2.170.0100.00722.96
8.2.160.0060.00922.21
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0060.00320.97
8.2.110.0030.00620.68
8.2.100.0060.00618.09
8.2.90.0040.00419.51
8.2.80.0040.00419.51
8.2.70.0090.00018.13
8.2.60.0040.00418.05
8.2.50.0030.00618.07
8.2.40.0040.00418.34
8.2.30.0000.00719.51
8.2.20.0000.00818.06
8.2.10.0000.00818.23
8.2.00.0030.00518.05
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0000.01122.32
8.1.230.0030.00917.95
8.1.220.0040.00417.89
8.1.210.0040.00418.77
8.1.200.0000.00917.85
8.1.190.0040.00417.65
8.1.180.0000.00818.10
8.1.170.0040.00418.96
8.1.160.0040.00419.04
8.1.150.0000.00719.09
8.1.140.0060.00317.70
8.1.130.0000.00718.07
8.1.120.0000.00717.90
8.1.110.0040.00417.77
8.1.100.0030.00617.74
8.1.90.0040.00417.82
8.1.80.0030.00517.80
8.1.70.0000.00717.80
8.1.60.0030.00617.89
8.1.50.0030.00517.68
8.1.40.0000.00817.80
8.1.30.0080.00017.94
8.1.20.0030.00517.89
8.1.10.0040.00417.93
8.1.00.0070.00017.86
8.0.300.0050.00318.77
8.0.290.0040.00417.42
8.0.280.0050.00318.70
8.0.270.0000.00817.51
8.0.260.0030.00317.13
8.0.250.0030.00317.38
8.0.240.0000.00817.36
8.0.230.0000.00717.39
8.0.220.0030.00417.32
8.0.210.0070.00017.29
8.0.200.0030.00317.33
8.0.190.0030.00517.36
8.0.180.0040.00417.36
8.0.170.0060.00317.32
8.0.160.0070.00017.13
8.0.150.0030.00317.25
8.0.140.0040.00417.17
8.0.130.0060.00013.73
8.0.120.0020.00517.32
8.0.110.0030.00517.29
8.0.100.0000.00817.22
8.0.90.0040.00417.37
8.0.80.0130.00317.28
8.0.70.0040.00417.23
8.0.60.0000.00717.39
8.0.50.0080.00017.15
8.0.30.0170.00317.51
8.0.20.0130.00717.56
8.0.10.0000.00717.32
8.0.00.0050.01317.20
7.4.330.0000.00516.78
7.4.320.0030.00316.82
7.4.300.0000.00616.77
7.4.290.0000.00716.91
7.4.280.0000.00716.77
7.4.270.0050.00316.96
7.4.260.0030.00313.53
7.4.250.0060.00316.68
7.4.240.0020.00516.88
7.4.230.0000.00716.73
7.4.220.0060.01316.86
7.4.210.0070.00816.94
7.4.200.0000.00716.62
7.4.190.0000.00716.79
7.4.160.0100.01417.07
7.4.150.0110.00717.40
7.4.140.0080.00917.86
7.4.130.0130.00416.93
7.4.120.0140.00316.89
7.4.110.0090.00817.16
7.4.100.0120.00616.95
7.4.90.0000.01716.81
7.4.80.0070.01319.39
7.4.70.0060.01016.91
7.4.60.0050.02016.89
7.4.50.0030.00616.96
7.4.40.0040.01222.77
7.4.30.0190.00016.88
7.4.10.0100.01015.34
7.4.00.0020.01415.38
7.3.330.0000.00513.52
7.3.320.0060.00013.66
7.3.310.0030.00316.69
7.3.300.0040.00416.52
7.3.290.0070.01016.62
7.3.280.0080.00916.63
7.3.270.0090.00917.40
7.3.260.0160.00318.24
7.3.250.0140.00716.78
7.3.240.0060.01016.76
7.3.230.0130.00616.79
7.3.210.0130.00316.58
7.3.200.0090.01219.39
7.3.190.0060.01316.64
7.3.180.0030.01416.66
7.3.170.0130.00316.84
7.3.160.0100.00616.94
7.3.130.0070.01115.12
7.3.120.0120.00515.11
7.3.110.0110.00815.31
7.3.100.0090.00615.24
7.3.90.0020.01515.13
7.3.80.0060.00715.04
7.3.70.0050.00915.17
7.3.60.0050.00915.01
7.3.50.0060.00615.13
7.3.40.0090.00615.14
7.3.30.0040.00915.10
7.3.20.0060.00916.81
7.3.10.0070.00916.88
7.3.00.0070.00716.80
7.2.330.0100.00717.06
7.2.320.0090.01517.16
7.2.310.0170.00016.90
7.2.300.0030.01416.94
7.2.290.0030.01316.79
7.2.260.0060.00615.27
7.2.250.0050.01315.13
7.2.240.0050.01215.20
7.2.230.0050.01315.42
7.2.220.0050.00915.15
7.2.210.0070.00515.06
7.2.200.0070.00715.34
7.2.190.0050.00715.10
7.2.180.0050.00915.33
7.2.170.0040.00715.21
7.2.160.0070.01015.32
7.2.150.0070.01017.29
7.2.140.0040.01117.22
7.2.130.0040.01117.03
7.2.120.0040.00417.09
7.2.110.0030.00616.98
7.2.100.0120.00317.25
7.2.90.0040.01417.28
7.2.80.0000.01217.16
7.2.70.0070.01017.08
7.2.60.0030.00616.95
7.2.50.0060.01217.03
7.2.40.0100.00317.01
7.2.30.0060.00617.32
7.2.20.0080.01216.93
7.2.10.0070.00417.37
7.2.00.0050.00818.37
7.1.330.0070.00915.88
7.1.320.0050.00716.02
7.1.310.0070.00716.01
7.1.300.0030.01115.95
7.1.290.0100.00316.05
7.1.280.0070.00316.03
7.1.270.0070.00315.96
7.1.260.0070.00216.00
7.1.250.0000.01216.01
7.1.240.0060.00615.99
7.1.230.0040.01116.08
7.1.220.0080.00316.24
7.1.210.0030.00915.80
7.1.200.0030.00715.95
7.1.190.0070.00716.16
7.1.180.0030.01216.05
7.1.170.0030.01315.99
7.1.160.0000.00915.96
7.1.150.0100.00715.95
7.1.140.0030.01415.96
7.1.130.0050.00816.20
7.1.120.0080.00615.64
7.1.110.0000.01415.92
7.1.100.0060.00517.16
7.1.90.0110.00416.15
7.1.80.0030.01016.17
7.1.70.0050.00616.61
7.1.60.0070.01017.53
7.1.50.0050.01316.76
7.1.40.0000.01016.18
7.1.30.0030.01015.98
7.1.20.0060.00915.79
7.1.10.0150.00016.05
7.1.00.0050.02019.13
7.0.330.0040.01115.27
7.0.320.0060.00315.36
7.0.310.0070.00315.36
7.0.300.0070.00715.53
7.0.290.0070.00315.53
7.0.280.0110.00315.41
7.0.270.0090.00615.58
7.0.260.0070.00715.53
7.0.250.0060.00915.64
7.0.240.0130.00015.79
7.0.230.0070.00415.55
7.0.220.0060.00715.71
7.0.210.0030.01115.78
7.0.200.0020.00916.33
7.0.190.0000.01415.70
7.0.180.0070.00715.75
7.0.170.0080.00815.52
7.0.160.0060.00315.45
7.0.150.0000.01115.65
7.0.140.0090.03518.78
7.0.130.0030.01015.61
7.0.120.0060.00915.64
7.0.110.0000.01115.77
7.0.100.0070.00715.55
7.0.90.0120.00315.57
7.0.80.0270.04617.87
7.0.70.0060.04117.73
7.0.60.0050.04317.82
7.0.50.0210.03018.10
7.0.40.0070.04216.96
7.0.30.0090.02616.88
7.0.20.0150.03816.88
7.0.10.0070.04716.95
7.0.00.0120.02816.78
5.6.400.0030.01014.54
5.6.390.0120.00314.61
5.6.380.0150.00014.78
5.6.370.0100.00314.76
5.6.360.0030.01014.68
5.6.350.0060.00914.72
5.6.340.0040.01414.83
5.6.330.0000.01014.64
5.6.320.0060.01114.61
5.6.310.0070.00414.98
5.6.300.0000.01314.76
5.6.290.0080.00814.73
5.6.280.0030.04117.78
5.6.270.0100.00014.95
5.6.260.0060.00614.69
5.6.250.0110.00414.43
5.6.240.0030.01014.84
5.6.230.0080.02617.57
5.6.220.0040.04217.57
5.6.210.0100.04017.71
5.6.200.0130.03717.73
5.6.190.0100.03717.99
5.6.180.0100.03517.76
5.6.170.0060.04017.77
5.6.160.0050.04017.95
5.6.150.0020.03017.86
5.6.140.0080.04517.90
5.6.130.0060.04517.74
5.6.120.0120.03217.81
5.6.110.0100.04518.02
5.6.100.0120.02517.91
5.6.90.0090.04017.98
5.6.80.0110.03817.49
5.6.70.0070.02817.36
5.6.60.0050.02417.46
5.6.50.0070.04917.46
5.6.40.0150.03517.53
5.6.30.0080.04117.44
5.6.20.0070.03217.53
5.6.10.0050.04617.55
5.6.00.0030.04617.55
5.5.380.0030.00614.55
5.5.370.0070.04517.61
5.5.360.0090.02217.56
5.5.350.0120.02217.65
5.5.340.0050.04717.69
5.5.330.0050.05217.74
5.5.320.0060.04517.63
5.5.310.0020.03417.74
5.5.300.0030.02817.70
5.5.290.0070.03117.60
5.5.280.0090.03017.72
5.5.270.0070.03317.70
5.5.260.0110.04517.85
5.5.250.0080.04517.53
5.5.240.0050.04417.41
5.5.230.0100.04317.31
5.5.220.0120.03017.34
5.5.210.0070.03917.39
5.5.200.0100.03917.25
5.5.190.0100.03717.34
5.5.180.0100.04017.52
5.5.170.0030.00614.66
5.5.160.0070.03917.26
5.5.150.0070.04417.29
5.5.140.0060.04417.43
5.5.130.0070.03617.40
5.5.120.0090.03917.35
5.5.110.0100.04217.43
5.5.100.0060.03217.32
5.5.90.0070.02817.21
5.5.80.0020.03917.21
5.5.70.0070.04017.22
5.5.60.0070.04217.26
5.5.50.0100.04017.32
5.5.40.0050.03817.27
5.5.30.0060.04117.27
5.5.20.0040.02917.42
5.5.10.0030.04717.31
5.5.00.0050.02517.20
5.4.450.0080.03715.35
5.4.440.0070.04215.34
5.4.430.0080.04015.46
5.4.420.0060.03915.39
5.4.410.0120.03515.18
5.4.400.0080.02815.24
5.4.390.0110.03615.30
5.4.380.0110.03815.21
5.4.370.0050.04015.16
5.4.360.0040.03015.27
5.4.350.0020.03415.31
5.4.340.0100.03715.19
5.4.330.0040.00711.43
5.4.320.0140.03315.27
5.4.310.0080.03815.10
5.4.300.0030.04315.25
5.4.290.0060.04015.14
5.4.280.0080.04015.23
5.4.270.0040.03715.26
5.4.260.0070.03815.30
5.4.250.0110.03615.10
5.4.240.0090.02215.11
5.4.230.0020.02715.15
5.4.220.0050.04315.04
5.4.210.0030.04215.01
5.4.200.0050.04515.31
5.4.190.0070.03815.08
5.4.180.0120.03215.04
5.4.170.0020.04215.15
5.4.160.0100.02015.17
5.4.150.0130.01715.19
5.4.140.0080.03813.99
5.4.130.0060.02813.94
5.4.120.0080.02113.89
5.4.110.0080.03313.92
5.4.100.0070.02713.75
5.4.90.0030.03813.88
5.4.80.0050.02213.95
5.4.70.0030.04013.95
5.4.60.0020.05013.91
5.4.50.0020.02213.99
5.4.40.0040.03913.90
5.4.30.0070.01814.00
5.4.20.0030.04213.89
5.4.10.0030.04213.85
5.4.00.0070.03313.57
5.3.290.0060.04812.79
5.3.280.0050.04012.79
5.3.270.0060.02312.75
5.3.260.0060.04512.84
5.3.250.0080.04012.79
5.3.240.0070.03812.77
5.3.230.0060.02812.75
5.3.220.0000.04712.54
5.3.210.0020.02812.60
5.3.200.0070.03712.67
5.3.190.0050.04112.73
5.3.180.0030.03312.71
5.3.170.0030.03612.68
5.3.160.0080.03612.75
5.3.150.0050.02712.66
5.3.140.0080.03312.73
5.3.130.0020.04112.80
5.3.120.0080.03912.73
5.3.110.0080.02112.68
5.3.100.0050.03512.54
5.3.90.0070.04012.42
5.3.80.0070.03812.30
5.3.70.0110.03012.46
5.3.60.0050.04012.30
5.3.50.0080.03812.29
5.3.40.0050.04012.32
5.3.30.0070.03412.42
5.3.20.0050.03612.26
5.3.10.0050.03312.09
5.3.00.0050.02512.09
5.2.170.0070.05711.17
5.2.160.0000.06711.27
5.2.150.0030.06311.25
5.2.140.0070.05311.19
5.2.130.0100.04311.11
5.2.120.0030.06011.19
5.2.110.0000.04311.02
5.2.100.0070.05710.98
5.2.90.0030.04011.26
5.2.80.0000.03711.05
5.2.70.0070.06311.03
5.2.60.0000.04011.00
5.2.50.0130.05711.05
5.2.40.0100.03311.16
5.2.30.0030.06311.08
5.2.20.0130.05711.01
5.2.10.0070.05710.89
5.2.00.0070.05710.86
5.1.60.0100.04310.12
5.1.50.0070.05310.00
5.1.40.0030.0439.99
5.1.30.0030.05710.48
5.1.20.0000.06310.38
5.1.10.0070.05710.16
5.1.00.0130.03710.20
5.0.50.0070.0238.57
5.0.40.0000.0238.51
5.0.30.0000.0478.31
5.0.20.0000.0438.24
5.0.10.0030.0478.11
5.0.00.0000.0378.27
4.4.90.0000.0307.46
4.4.80.0030.0337.46
4.4.70.0000.0337.46
4.4.60.0030.0207.46
4.4.50.0030.0337.46
4.4.40.0000.0477.46
4.4.30.0000.0307.46
4.4.20.0070.0307.46
4.4.10.0000.0277.46
4.4.00.0030.0537.46
4.3.110.0000.0337.46
4.3.100.0030.0337.46
4.3.90.0000.0377.46
4.3.80.0030.0507.46
4.3.70.0000.0237.46
4.3.60.0070.0337.46
4.3.50.0130.0277.46
4.3.40.0030.0407.46
4.3.30.0000.0377.46
4.3.20.0030.0307.46
4.3.10.0000.0337.46
4.3.00.0070.0207.46

preferences:
64.06 ms | 401 KiB | 5 Q