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, 1417305600); 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.00718.68
8.3.50.0100.01221.27
8.3.40.0070.00719.34
8.3.30.0040.01120.42
8.3.20.0090.00020.31
8.3.10.0040.00422.09
8.3.00.0040.00422.45
8.2.180.0090.00916.88
8.2.170.0120.00622.96
8.2.160.0100.00322.24
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00421.13
8.2.110.0090.00020.65
8.2.100.0090.00318.16
8.2.90.0000.00819.34
8.2.80.0000.00818.46
8.2.70.0090.00017.88
8.2.60.0040.00418.05
8.2.50.0000.00918.10
8.2.40.0000.00820.55
8.2.30.0040.00419.48
8.2.20.0050.00318.06
8.2.10.0000.00718.22
8.2.00.0040.00418.25
8.1.280.0140.00325.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0040.00722.80
8.1.230.0110.00018.07
8.1.220.0050.00318.02
8.1.210.0040.00418.77
8.1.200.0030.00717.85
8.1.190.0000.00917.73
8.1.180.0000.00918.10
8.1.170.0000.01018.88
8.1.160.0040.00422.31
8.1.150.0050.00319.00
8.1.140.0050.00317.87
8.1.130.0000.00817.91
8.1.120.0040.00417.73
8.1.110.0000.00817.85
8.1.100.0040.00417.78
8.1.90.0040.00417.75
8.1.80.0040.00417.70
8.1.70.0000.00717.78
8.1.60.0030.00617.92
8.1.50.0040.00417.74
8.1.40.0000.00817.80
8.1.30.0000.00817.83
8.1.20.0040.00417.93
8.1.10.0080.00017.86
8.1.00.0000.00817.81
8.0.300.0000.00818.77
8.0.290.0040.00417.25
8.0.280.0000.00718.69
8.0.270.0070.00017.57
8.0.260.0030.00317.19
8.0.250.0020.00517.41
8.0.240.0040.00417.23
8.0.230.0000.00717.27
8.0.220.0000.00717.36
8.0.210.0000.00717.30
8.0.200.0070.00017.27
8.0.190.0090.00017.39
8.0.180.0000.00717.35
8.0.170.0000.00817.25
8.0.160.0040.00417.32
8.0.150.0000.00717.22
8.0.140.0000.00917.21
8.0.130.0030.00313.57
8.0.120.0040.00417.25
8.0.110.0070.00017.21
8.0.100.0050.00317.36
8.0.90.0050.00217.16
8.0.80.0100.00617.29
8.0.70.0050.00317.33
8.0.60.0070.00017.20
8.0.50.0040.00417.33
8.0.30.0110.01217.38
8.0.20.0100.00917.57
8.0.10.0070.00017.30
8.0.00.0110.00917.19
7.4.330.0000.00516.90
7.4.320.0000.00616.71
7.4.300.0070.00016.75
7.4.290.0030.00316.81
7.4.280.0030.00316.89
7.4.270.0050.00216.92
7.4.260.0030.00313.55
7.4.250.0040.00416.79
7.4.240.0040.00416.74
7.4.230.0040.00416.70
7.4.220.0030.01516.91
7.4.210.0110.00416.92
7.4.200.0080.00016.92
7.4.190.0040.00417.00
7.4.160.0070.01716.86
7.4.150.0110.00617.40
7.4.140.0090.00817.86
7.4.130.0100.01016.89
7.4.120.0120.00716.84
7.4.110.0100.00716.64
7.4.100.0090.01216.87
7.4.90.0090.01316.98
7.4.80.0080.01119.39
7.4.70.0070.01016.83
7.4.60.0140.00716.80
7.4.50.0060.00316.94
7.4.40.0000.01522.77
7.4.30.0090.00916.83
7.4.10.0000.01815.30
7.4.00.0070.01115.18
7.3.330.0000.00613.50
7.3.320.0000.00513.64
7.3.310.0040.00416.50
7.3.300.0000.00716.53
7.3.290.0120.00316.61
7.3.280.0090.00716.68
7.3.270.0100.01417.40
7.3.260.0070.01618.24
7.3.250.0100.01016.78
7.3.240.0060.01016.86
7.3.230.0100.00716.79
7.3.210.0030.01416.84
7.3.200.0180.00419.39
7.3.190.0120.00616.63
7.3.180.0080.01117.01
7.3.170.0060.00916.74
7.3.160.0130.00316.90
7.3.130.0060.00914.75
7.3.120.0070.00815.11
7.3.110.0110.00815.09
7.3.100.0060.00615.37
7.3.90.0070.00415.16
7.3.80.0070.00415.02
7.3.70.0040.01415.13
7.3.60.0070.01115.30
7.3.50.0120.00315.14
7.3.40.0040.00415.11
7.3.30.0110.00415.07
7.3.20.0080.00317.12
7.3.10.0070.01016.58
7.3.00.0140.00316.65
7.2.330.0090.01216.86
7.2.320.0180.00017.19
7.2.310.0070.01017.11
7.2.300.0120.00417.07
7.2.290.0070.01017.09
7.2.260.0130.00615.37
7.2.250.0100.00715.22
7.2.240.0000.01615.63
7.2.230.0030.01315.25
7.2.220.0000.01315.31
7.2.210.0030.01415.18
7.2.200.0080.00415.32
7.2.190.0070.01315.43
7.2.180.0070.00315.18
7.2.170.0070.00715.34
7.2.160.0120.00315.51
7.2.150.0000.01017.10
7.2.140.0070.00717.07
7.2.130.0070.00916.87
7.2.120.0100.01316.72
7.2.110.0070.01317.03
7.2.100.0070.01117.24
7.2.90.0090.01016.89
7.2.80.0130.01017.03
7.2.70.0090.01217.02
7.2.60.0090.00617.21
7.2.50.0080.00517.19
7.2.40.0120.01116.76
7.2.30.0060.01417.01
7.2.20.0150.00817.06
7.2.10.0110.00916.86
7.2.00.0110.00917.83
7.1.330.0090.00616.27
7.1.320.0060.00915.87
7.1.310.0060.00615.94
7.1.300.0050.00815.95
7.1.290.0000.01515.84
7.1.280.0040.00816.12
7.1.270.0060.00615.92
7.1.260.0130.00016.15
7.1.250.0030.01515.85
7.1.240.0000.01415.93
7.1.230.0040.00716.19
7.1.220.0070.00715.83
7.1.210.0060.00616.27
7.1.200.0100.00316.04
7.1.190.0100.00316.10
7.1.180.0000.01016.19
7.1.170.0150.00016.13
7.1.160.0030.01015.80
7.1.150.0070.00316.04
7.1.140.0000.01416.08
7.1.130.0000.01116.24
7.1.120.0000.01716.13
7.1.110.0040.01115.82
7.1.100.0020.01117.22
7.1.90.0000.01516.23
7.1.80.0120.00615.89
7.1.70.0050.00816.47
7.1.60.0080.01217.52
7.1.50.0060.00816.45
7.1.40.0040.00815.98
7.1.30.0060.00815.94
7.1.20.0060.00616.10
7.1.10.0040.00715.88
7.1.00.0030.02119.30
7.0.330.0000.01715.58
7.0.320.0040.00715.64
7.0.310.0040.01115.42
7.0.300.0100.00315.59
7.0.290.0070.00715.70
7.0.280.0110.00315.63
7.0.270.0040.00715.61
7.0.260.0070.00715.63
7.0.250.0000.00815.78
7.0.240.0000.00815.42
7.0.230.0070.00715.40
7.0.220.0060.00615.73
7.0.210.0030.01015.50
7.0.200.0070.01016.35
7.0.190.0050.00515.75
7.0.180.0090.00315.47
7.0.170.0080.00315.66
7.0.160.0030.01015.72
7.0.150.0150.00315.46
7.0.140.0000.04518.87
7.0.130.0110.00415.61
7.0.120.0080.00615.41
7.0.110.0000.01215.51
7.0.100.0070.02917.79
7.0.90.0020.02417.80
7.0.80.0040.02317.79
7.0.70.0050.02517.77
7.0.60.0090.03017.83
7.0.50.0030.02818.09
7.0.40.0030.02816.94
7.0.30.0050.02516.94
7.0.20.0080.04316.87
7.0.10.0020.05216.80
7.0.00.0080.02516.87
5.6.400.0000.01614.41
5.6.390.0110.00714.77
5.6.380.0030.01214.63
5.6.370.0040.01114.49
5.6.360.0060.00914.86
5.6.350.0130.00014.55
5.6.340.0090.00314.91
5.6.330.0040.01214.55
5.6.320.0040.00714.40
5.6.310.0120.00314.86
5.6.300.0030.01214.64
5.6.290.0030.01014.81
5.6.280.0050.04017.66
5.6.270.0030.00914.82
5.6.260.0030.00914.63
5.6.250.0050.02317.59
5.6.240.0050.02317.54
5.6.230.0030.02317.68
5.6.220.0050.02717.65
5.6.210.0020.02917.84
5.6.200.0060.02517.88
5.6.190.0050.02517.98
5.6.180.0050.04317.85
5.6.170.0110.04018.01
5.6.160.0120.03717.88
5.6.150.0080.02317.89
5.6.140.0050.03017.86
5.6.130.0080.04317.79
5.6.120.0070.03017.68
5.6.110.0080.04617.89
5.6.100.0100.03517.86
5.6.90.0050.04217.88
5.6.80.0050.02917.46
5.6.70.0030.03717.56
5.6.60.0040.03017.50
5.6.50.0090.03417.57
5.6.40.0090.02017.42
5.6.30.0020.03417.55
5.6.20.0030.02817.38
5.6.10.0120.03417.57
5.6.00.0100.04017.50
5.5.380.0130.01517.65
5.5.370.0000.02817.64
5.5.360.0070.02217.46
5.5.350.0040.02317.48
5.5.340.0050.02417.79
5.5.330.0030.03017.79
5.5.320.0000.04717.73
5.5.310.0050.03517.66
5.5.300.0070.04617.64
5.5.290.0070.04517.80
5.5.280.0060.04017.79
5.5.270.0040.03617.61
5.5.260.0070.04717.70
5.5.250.0100.03817.47
5.5.240.0120.03617.21
5.5.230.0030.04317.51
5.5.220.0050.04017.45
5.5.210.0070.04017.34
5.5.200.0030.02717.38
5.5.190.0050.02917.21
5.5.180.0070.02617.46
5.5.170.0000.00914.54
5.5.160.0080.04317.34
5.5.150.0020.03517.41
5.5.140.0050.03617.47
5.5.130.0080.03817.52
5.5.120.0100.04217.39
5.5.110.0020.05117.39
5.5.100.0070.04017.32
5.5.90.0090.03217.23
5.5.80.0050.02417.25
5.5.70.0070.03917.34
5.5.60.0040.04717.27
5.5.50.0060.03617.27
5.5.40.0030.04217.42
5.5.30.0030.03817.30
5.5.20.0050.04617.38
5.5.10.0060.04517.33
5.5.00.0060.04017.41
5.4.450.0070.04315.34
5.4.440.0050.04115.42
5.4.430.0070.03315.41
5.4.420.0000.03515.41
5.4.410.0020.04915.31
5.4.400.0020.04615.36
5.4.390.0020.02915.24
5.4.380.0060.04115.13
5.4.370.0110.03615.10
5.4.360.0030.02315.36
5.4.350.0070.04015.22
5.4.340.0050.04015.11
5.4.330.0030.00311.54
5.4.320.0080.02615.36
5.4.310.0070.03915.13
5.4.300.0030.02515.27
5.4.290.0050.02615.17
5.4.280.0000.04815.30
5.4.270.0070.02415.13
5.4.260.0070.02815.25
5.4.250.0070.02215.17
5.4.240.0070.02315.20
5.4.230.0050.04415.23
5.4.220.0020.03015.26
5.4.210.0030.04515.20
5.4.200.0040.03415.24
5.4.190.0000.04715.10
5.4.180.0050.02815.26
5.4.170.0050.02915.22
5.4.160.0030.03215.23
5.4.150.0030.04315.19
5.4.140.0030.04313.93
5.4.130.0070.03213.83
5.4.120.0000.04213.85
5.4.110.0020.04213.88
5.4.100.0060.02614.02
5.4.90.0050.03813.91
5.4.80.0020.04013.94
5.4.70.0050.04013.84
5.4.60.0000.02813.94
5.4.50.0040.04013.92
5.4.40.0070.03713.90
5.4.30.0040.04213.98
5.4.20.0080.02013.98
5.4.10.0090.03714.00
5.4.00.0080.02713.65
5.3.290.0030.02912.99
5.3.280.0020.02712.96
5.3.270.0000.02913.02
5.3.260.0050.03812.97
5.3.250.0070.02013.04
5.3.240.0070.02213.00
5.3.230.0070.03813.01
5.3.220.0050.02412.94
5.3.210.0080.03813.01
5.3.200.0060.04112.94
5.3.190.0030.02513.01
5.3.180.0070.04212.97
5.3.170.0020.04212.94
5.3.160.0140.03112.98
5.3.150.0050.03112.92
5.3.140.0030.02312.96
5.3.130.0020.04312.99
5.3.120.0080.03812.92
5.3.110.0060.04212.93
5.3.100.0070.02212.76
5.3.90.0020.04212.74
5.3.80.0100.03512.69
5.3.70.0050.03612.67
5.3.60.0070.02512.63
5.3.50.0050.03912.67
5.3.40.0000.04412.61
5.3.30.0070.03612.63
5.3.20.0030.04212.52
5.3.10.0030.04012.46
5.3.00.0050.03812.44
5.2.170.0130.05011.19
5.2.160.0100.05311.23
5.2.150.0030.06311.16
5.2.140.0070.04711.25
5.2.130.0000.04011.14
5.2.120.0030.05311.26
5.2.110.0100.04311.25
5.2.100.0030.04711.25
5.2.90.0030.03711.26
5.2.80.0030.03011.22
5.2.70.0100.05011.18
5.2.60.0030.04711.18
5.2.50.0070.04711.10
5.2.40.0070.06011.10
5.2.30.0000.06311.05
5.2.20.0030.04010.99
5.2.10.0070.03010.95
5.2.00.0030.04710.86
5.1.60.0100.04310.00
5.1.50.0030.03010.10
5.1.40.0030.0539.98
5.1.30.0030.04710.48
5.1.20.0100.05010.52
5.1.10.0070.0579.94
5.1.00.0100.04010.16
5.0.50.0100.0439.48
5.0.40.0000.0439.48
5.0.30.0030.0609.48
5.0.20.0070.0209.48
5.0.10.0000.0239.48
5.0.00.0030.0539.48
4.4.90.0000.0339.48
4.4.80.0000.0379.48
4.4.70.0030.0239.48
4.4.60.0000.0239.48
4.4.50.0030.0139.48
4.4.40.0000.0539.48
4.4.30.0030.0279.48
4.4.20.0000.0379.48
4.4.10.0030.0339.48
4.4.00.0000.0579.48
4.3.110.0030.0239.48
4.3.100.0070.0139.48
4.3.90.0030.0239.48
4.3.80.0070.0539.48
4.3.70.0070.0309.48
4.3.60.0000.0309.48
4.3.50.0000.0279.48
4.3.40.0030.0409.48
4.3.30.0000.0339.48
4.3.20.0000.0379.48
4.3.10.0070.0279.48
4.3.00.0000.0239.48

preferences:
48.67 ms | 401 KiB | 5 Q