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, 1483142400); 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.01217.00
8.3.60.0150.00618.75
8.3.50.0090.00921.21
8.3.40.0120.00319.22
8.3.30.0070.00720.35
8.3.20.0080.00020.34
8.3.10.0040.00422.05
8.3.00.0040.00422.45
8.2.180.0120.00916.88
8.2.170.0170.00322.96
8.2.160.0130.00022.26
8.2.150.0090.00024.18
8.2.140.0030.00724.66
8.2.130.0040.00426.16
8.2.120.0070.00020.88
8.2.110.0060.00322.34
8.2.100.0150.00418.03
8.2.90.0000.00819.35
8.2.80.0050.00319.31
8.2.70.0050.00317.88
8.2.60.0040.00418.05
8.2.50.0050.00318.07
8.2.40.0000.00818.25
8.2.30.0000.00819.48
8.2.20.0050.00318.11
8.2.10.0000.00818.17
8.2.00.0000.00817.99
8.1.280.0090.00625.92
8.1.270.0000.00923.99
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00324.11
8.1.230.0120.00017.83
8.1.220.0050.00317.90
8.1.210.0040.00418.77
8.1.200.0060.00317.73
8.1.190.0000.00817.54
8.1.180.0080.00018.10
8.1.170.0000.00818.76
8.1.160.0070.00019.12
8.1.150.0040.00418.94
8.1.140.0050.00217.63
8.1.130.0000.00718.01
8.1.120.0030.00517.75
8.1.110.0000.00717.74
8.1.100.0040.00417.67
8.1.90.0040.00417.67
8.1.80.0040.00417.78
8.1.70.0030.00517.66
8.1.60.0000.00917.87
8.1.50.0040.00417.78
8.1.40.0030.00617.74
8.1.30.0030.00617.86
8.1.20.0000.00817.93
8.1.10.0030.00517.80
8.1.00.0040.00417.80
8.0.300.0050.00219.17
8.0.290.0000.00817.29
8.0.280.0040.00418.63
8.0.270.0050.00317.44
8.0.260.0000.00717.20
8.0.250.0000.00817.41
8.0.240.0060.00317.20
8.0.230.0000.00717.35
8.0.220.0030.00317.33
8.0.210.0030.00317.32
8.0.200.0030.00317.34
8.0.190.0070.00017.30
8.0.180.0040.00417.15
8.0.170.0030.00517.19
8.0.160.0030.00317.26
8.0.150.0070.00017.32
8.0.140.0030.00617.21
8.0.130.0050.00013.68
8.0.120.0030.00517.22
8.0.110.0000.00817.31
8.0.100.0040.00417.34
8.0.90.0000.00817.16
8.0.80.0090.00617.24
8.0.70.0000.00717.30
8.0.60.0030.00517.16
8.0.50.0000.00717.13
8.0.30.0120.01017.36
8.0.20.0110.00717.41
8.0.10.0040.00417.43
8.0.00.0190.00517.09
7.4.330.0020.00216.90
7.4.320.0060.00016.87
7.4.300.0030.00316.77
7.4.290.0040.00416.84
7.4.280.0040.00416.74
7.4.270.0000.00716.84
7.4.260.0000.00513.45
7.4.250.0030.00516.84
7.4.240.0010.00616.80
7.4.230.0000.00716.71
7.4.220.0090.00916.96
7.4.210.0060.01016.78
7.4.200.0070.00016.68
7.4.190.0070.00016.91
7.4.160.0130.00716.73
7.4.150.0180.00017.40
7.4.140.0090.01217.86
7.4.130.0120.00716.75
7.4.120.0110.01116.74
7.4.110.0100.00716.86
7.4.100.0100.00716.82
7.4.90.0140.00316.96
7.4.80.0100.00719.39
7.4.70.0060.01016.70
7.4.60.0100.00716.90
7.4.50.0030.00516.55
7.4.40.0060.01022.77
7.4.30.0030.01416.99
7.4.10.0100.01015.48
7.4.00.0020.01515.44
7.3.330.0000.00513.37
7.3.320.0000.00613.57
7.3.310.0000.00716.45
7.3.300.0030.00616.61
7.3.290.0070.00716.59
7.3.280.0060.01116.60
7.3.270.0170.00717.40
7.3.260.0120.00618.24
7.3.250.0150.00616.67
7.3.240.0120.00616.62
7.3.230.0070.01316.76
7.3.210.0000.01616.80
7.3.200.0120.00619.39
7.3.190.0070.01016.52
7.3.180.0120.00616.61
7.3.170.0030.01316.96
7.3.160.0080.00816.70
7.3.130.0070.01114.95
7.3.120.0070.00815.10
7.3.110.0040.01215.28
7.3.100.0030.01015.15
7.3.90.0060.01014.88
7.3.80.0090.00915.05
7.3.70.0070.00415.04
7.3.60.0070.00714.84
7.3.50.0110.00415.01
7.3.40.0030.00815.11
7.3.30.0000.00914.70
7.3.20.0060.01016.93
7.3.10.0040.01116.82
7.3.00.0000.00916.64
7.2.330.0110.00716.99
7.2.320.0130.01017.14
7.2.310.0070.01116.65
7.2.300.0060.01216.77
7.2.290.0100.00617.05
7.2.260.0110.00315.32
7.2.250.0070.00715.27
7.2.240.0000.01515.33
7.2.230.0060.01015.59
7.2.220.0030.01015.54
7.2.210.0090.00315.35
7.2.200.0030.00815.39
7.2.190.0070.01015.32
7.2.180.0030.01415.22
7.2.170.0120.00015.36
7.2.160.0100.00715.16
7.2.150.0070.00717.07
7.2.140.0060.00917.20
7.2.130.0140.00017.22
7.2.120.0100.00717.35
7.2.110.0060.00917.15
7.2.100.0030.01317.29
7.2.90.0000.01617.21
7.2.80.0030.01417.16
7.2.70.0060.01216.93
7.2.60.0030.00717.34
7.2.50.0090.00617.34
7.2.40.0030.01116.96
7.2.30.0060.00617.22
7.2.20.0090.00617.16
7.2.10.0120.00317.27
7.2.00.0040.00918.41
7.1.330.0070.00716.09
7.1.320.0120.00316.04
7.1.310.0030.00916.21
7.1.300.0070.01116.03
7.1.290.0030.00616.22
7.1.280.0040.01115.96
7.1.270.0100.00316.05
7.1.260.0070.00415.77
7.1.250.0000.01416.05
7.1.240.0000.01616.20
7.1.230.0000.01716.17
7.1.220.0100.00716.12
7.1.210.0000.00815.82
7.1.200.0060.00916.21
7.1.190.0130.00316.02
7.1.180.0060.00316.04
7.1.170.0070.00715.93
7.1.160.0060.00615.98
7.1.150.0070.00716.07
7.1.140.0060.00915.82
7.1.130.0000.00815.74
7.1.120.0060.00616.15
7.1.110.0030.00916.04
7.1.100.0040.00917.29
7.1.90.0000.00816.12
7.1.80.0000.01315.96
7.1.70.0020.01016.72
7.1.60.0100.00917.67
7.1.50.0090.00816.79
7.1.40.0030.01015.91
7.1.30.0070.00716.11
7.1.20.0080.00615.78
7.1.10.0070.00716.16
7.1.00.0070.01819.02
7.0.330.0070.00415.65
7.0.320.0000.01415.56
7.0.310.0000.01015.61
7.0.300.0030.01015.62
7.0.290.0060.00615.63
7.0.280.0030.00915.38
7.0.270.0050.00515.79
7.0.260.0040.00415.57
7.0.250.0060.00315.55
7.0.240.0030.00915.36
7.0.230.0060.01015.75
7.0.220.0030.01015.40
7.0.210.0030.00715.30
7.0.200.0060.00316.36
7.0.190.0030.00915.63
7.0.180.0000.00815.60
7.0.170.0090.00615.42
7.0.160.0060.01115.63
7.0.150.0060.00615.57
7.0.140.0050.04018.85
7.0.130.0000.01615.58
7.0.120.0090.00615.48
7.0.110.0100.00315.59
7.0.100.0140.00015.54
7.0.90.0080.04018.65
7.0.80.0050.03818.53
7.0.70.0070.03518.57
7.0.60.0030.04318.62
7.0.50.0080.02818.79
7.0.40.0100.04116.77
7.0.30.0050.02716.94
7.0.20.0080.03216.75
7.0.10.0020.03916.88
7.0.00.0030.02616.74
5.6.400.0060.00714.64
5.6.390.0030.01014.87
5.6.380.0070.00714.62
5.6.370.0000.01414.52
5.6.360.0040.01114.30
5.6.350.0070.00714.77
5.6.340.0040.01114.63
5.6.330.0040.00414.67
5.6.320.0060.00614.81
5.6.310.0070.00714.38
5.6.300.0030.01014.52
5.6.290.0100.00314.61
5.6.280.0100.03617.74
5.6.270.0060.00914.93
5.6.260.0070.00714.79
5.6.250.0000.01314.78
5.6.240.0050.04217.70
5.6.230.0060.03117.56
5.6.220.0000.04617.71
5.6.210.0060.03417.59
5.6.200.0060.04117.89
5.6.190.0070.04017.89
5.6.180.0050.04017.91
5.6.170.0040.04717.85
5.6.160.0030.04417.93
5.6.150.0030.04817.68
5.6.140.0080.04217.88
5.6.130.0060.04318.05
5.6.120.0090.03817.77
5.6.110.0050.03217.69
5.6.100.0030.04517.85
5.6.90.0030.04617.96
5.6.80.0050.04317.49
5.6.70.0070.03917.56
5.6.60.0000.04517.46
5.6.50.0020.04817.53
5.6.40.0060.03017.63
5.6.30.0060.04317.53
5.6.20.0030.04517.46
5.6.10.0070.02417.60
5.6.00.0070.03517.62
5.5.380.0070.04017.68
5.5.370.0060.04517.47
5.5.360.0030.04917.58
5.5.350.0070.02517.58
5.5.340.0070.04517.85
5.5.330.0050.04117.82
5.5.320.0000.03417.79
5.5.310.0000.04917.89
5.5.300.0040.04717.74
5.5.290.0050.04017.72
5.5.280.0110.03717.70
5.5.270.0020.02717.90
5.5.260.0060.04217.68
5.5.250.0000.04917.65
5.5.240.0090.03817.34
5.5.230.0070.04017.50
5.5.220.0080.04217.40
5.5.210.0080.03617.47
5.5.200.0060.04017.43
5.5.190.0050.03717.40
5.5.180.0050.02217.40
5.5.170.0030.00714.70
5.5.160.0050.02717.48
5.5.150.0020.03317.43
5.5.140.0050.04517.38
5.5.130.0050.02517.41
5.5.120.0070.04617.37
5.5.110.0050.04317.53
5.5.100.0080.04017.45
5.5.90.0060.02017.38
5.5.80.0050.03217.29
5.5.70.0080.01817.18
5.5.60.0030.04117.32
5.5.50.0060.03817.43
5.5.40.0020.02817.40
5.5.30.0020.03917.34
5.5.20.0080.04017.36
5.5.10.0030.04317.31
5.5.00.0060.03617.22
5.4.450.0000.03315.36
5.4.440.0020.04215.16
5.4.430.0030.04215.43
5.4.420.0050.04215.30
5.4.410.0020.02515.44
5.4.400.0030.02715.13
5.4.390.0100.03715.16
5.4.380.0050.02515.20
5.4.370.0070.02815.16
5.4.360.0030.02915.29
5.4.350.0020.04115.09
5.4.340.0080.03815.21
5.4.330.0090.00011.43
5.4.320.0030.04015.17
5.4.310.0070.03215.31
5.4.300.0070.02215.25
5.4.290.0040.03615.25
5.4.280.0030.04215.14
5.4.270.0000.04215.27
5.4.260.0070.02015.20
5.4.250.0030.02315.21
5.4.240.0030.03015.20
5.4.230.0000.02515.12
5.4.220.0080.01815.36
5.4.210.0060.04115.03
5.4.200.0070.02815.19
5.4.190.0060.03815.18
5.4.180.0000.04615.32
5.4.170.0090.03615.33
5.4.160.0090.02415.23
5.4.150.0050.02315.04
5.4.140.0050.02013.90
5.4.130.0020.02014.03
5.4.120.0000.02813.87
5.4.110.0050.03613.90
5.4.100.0030.04013.85
5.4.90.0080.02313.88
5.4.80.0050.04013.85
5.4.70.0030.03814.01
5.4.60.0020.04213.99
5.4.50.0050.02413.90
5.4.40.0020.02813.98
5.4.30.0050.03313.87
5.4.20.0010.03813.80
5.4.10.0040.03513.96
5.4.00.0050.02213.68
5.3.290.0020.02712.88
5.3.280.0040.03912.59
5.3.270.0050.03812.82
5.3.260.0060.03012.66
5.3.250.0030.03512.79
5.3.240.0030.03412.62
5.3.230.0020.02512.80
5.3.220.0000.04312.64
5.3.210.0050.04012.79
5.3.200.0020.04112.67
5.3.190.0030.03612.70
5.3.180.0030.03912.77
5.3.170.0050.03712.69
5.3.160.0020.03312.70
5.3.150.0030.04012.86
5.3.140.0030.03712.86
5.3.130.0010.03112.73
5.3.120.0030.03512.83
5.3.110.0040.04012.69
5.3.100.0070.03812.56
5.3.90.0050.03812.56
5.3.80.0020.02512.46
5.3.70.0000.03912.53
5.3.60.0080.02812.43
5.3.50.0020.02112.46
5.3.40.0030.03412.38
5.3.30.0050.04212.57
5.3.20.0050.02512.55
5.3.10.0020.03412.42
5.3.00.0070.03412.39
5.2.170.0000.05714.19
5.2.160.0000.03014.19
5.2.150.0000.03714.19
5.2.140.0000.03714.19
5.2.130.0030.04714.19
5.2.120.0000.04714.19
5.2.110.0030.05714.19
5.2.100.0030.03314.19
5.2.90.0070.03314.19
5.2.80.0030.05014.19
5.2.70.0070.03714.19
5.2.60.0000.03714.19
5.2.50.0000.04714.19
5.2.40.0030.05714.19
5.2.30.0000.06314.19
5.2.20.0070.03314.19
5.2.10.0000.06014.19
5.2.00.0070.03014.19
5.1.60.0000.04314.19
5.1.50.0030.05014.19
5.1.40.0030.04314.19
5.1.30.0100.04714.19
5.1.20.0000.05714.19
5.1.10.0000.03314.19
5.1.00.0000.03314.19
5.0.50.0030.03314.19
5.0.40.0000.04014.19
5.0.30.0000.05714.19
5.0.20.0000.03014.19
5.0.10.0000.03314.19
5.0.00.0000.06714.19
4.4.90.0000.03714.19
4.4.80.0000.03314.19
4.4.70.0000.03714.19
4.4.60.0070.03014.19
4.4.50.0000.03314.19
4.4.40.0030.02714.19
4.4.30.0000.02714.19
4.4.20.0030.02714.19
4.4.10.0000.03314.19
4.4.00.0000.05014.19
4.3.110.0030.03314.19
4.3.100.0000.01714.19
4.3.90.0070.03014.19
4.3.80.0030.04314.19
4.3.70.0000.03314.19
4.3.60.0000.03314.19
4.3.50.0000.03014.19
4.3.40.0000.03014.19
4.3.30.0000.01714.19
4.3.20.0000.01714.19
4.3.10.0000.04014.19
4.3.00.0000.03014.19

preferences:
45.38 ms | 401 KiB | 5 Q