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; $temp = $inbetween / $i[0] / $i[0] / $i[1]; $tempDays = $temp % 365; 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($temp / 365.25); $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.60.0120.00318.81
8.3.50.0100.01021.20
8.3.40.0090.00619.04
8.3.30.0030.01020.34
8.3.20.0040.00420.43
8.3.10.0040.00422.11
8.3.00.0030.00622.63
8.2.180.0120.00616.75
8.2.170.0030.01322.96
8.2.160.0100.00322.21
8.2.150.0090.00024.18
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0070.00021.00
8.2.110.0030.00721.23
8.2.100.0060.00618.09
8.2.90.0060.00319.52
8.2.80.0080.00018.13
8.2.70.0080.00017.88
8.2.60.0000.00818.18
8.2.50.0000.00818.10
8.2.40.0030.00520.59
8.2.30.0030.00319.50
8.2.20.0050.00318.03
8.2.10.0040.00418.18
8.2.00.0040.00418.07
8.1.280.0110.00425.92
8.1.270.0080.00023.99
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0030.00722.87
8.1.230.0000.01118.08
8.1.220.0080.00018.16
8.1.210.0000.00918.77
8.1.200.0060.00317.85
8.1.190.0090.00017.73
8.1.180.0090.00018.10
8.1.170.0060.00318.86
8.1.160.0000.00722.39
8.1.150.0000.00819.02
8.1.140.0050.00317.88
8.1.130.0070.00018.04
8.1.120.0040.00417.77
8.1.110.0050.00317.77
8.1.100.0040.00417.84
8.1.90.0000.00717.73
8.1.80.0040.00417.74
8.1.70.0070.00017.77
8.1.60.0030.00617.80
8.1.50.0030.00617.83
8.1.40.0040.00417.80
8.1.30.0080.00017.94
8.1.20.0000.00917.97
8.1.10.0040.00417.93
8.1.00.0070.00017.73
8.0.300.0040.00418.77
8.0.290.0050.00217.25
8.0.280.0070.00018.71
8.0.270.0070.00017.57
8.0.260.0030.00317.11
8.0.250.0040.00217.44
8.0.240.0000.00817.30
8.0.230.0040.00417.27
8.0.220.0000.00717.30
8.0.210.0000.00717.37
8.0.200.0000.00717.40
8.0.190.0040.00417.29
8.0.180.0020.00517.34
8.0.170.0060.00317.37
8.0.160.0040.00417.24
8.0.150.0000.00817.38
8.0.140.0050.00317.33
8.0.130.0000.00613.62
8.0.120.0050.00317.23
8.0.110.0040.00417.23
8.0.100.0000.00817.23
8.0.90.0040.00417.31
8.0.80.0060.00917.32
8.0.70.0040.00417.17
8.0.60.0040.00417.25
8.0.50.0000.00817.44
8.0.30.0160.00817.30
8.0.20.0140.00817.41
8.0.10.0040.00417.36
8.0.00.0110.00816.98
7.4.330.0000.00516.80
7.4.320.0000.00716.67
7.4.300.0000.00716.81
7.4.290.0000.00716.82
7.4.280.0000.00716.84
7.4.270.0000.00716.96
7.4.260.0030.00313.52
7.4.250.0040.00416.90
7.4.240.0000.00716.77
7.4.230.0030.00316.70
7.4.220.0040.01516.76
7.4.210.0040.01216.85
7.4.200.0040.00416.70
7.4.190.0030.00516.77
7.4.160.0110.00816.92
7.4.150.0030.01317.40
7.4.140.0110.00617.86
7.4.130.0050.01416.96
7.4.120.0140.00816.79
7.4.110.0130.00316.68
7.4.100.0110.00716.77
7.4.90.0120.00616.85
7.4.80.0130.01019.39
7.4.70.0100.00716.77
7.4.60.0100.01016.89
7.4.50.0000.00816.67
7.4.40.0120.00022.77
7.4.30.0140.00616.80
7.4.00.0060.00915.16
7.3.330.0000.00513.47
7.3.320.0000.00613.59
7.3.310.0040.00416.46
7.3.300.0030.00316.61
7.3.290.0030.01016.72
7.3.280.0100.00716.62
7.3.270.0100.00717.40
7.3.260.0090.00918.24
7.3.250.0070.01016.74
7.3.240.0100.00616.86
7.3.230.0070.01116.84
7.3.210.0120.00616.91
7.3.200.0030.01319.39
7.3.190.0040.01816.91
7.3.180.0160.00016.64
7.3.170.0130.00316.72
7.3.160.0100.00716.82
7.3.120.0100.00515.01
7.3.110.0140.00315.25
7.3.100.0070.00715.08
7.3.90.0060.01215.24
7.3.80.0030.00615.21
7.3.70.0040.01115.02
7.3.60.0110.00315.25
7.3.50.0100.01015.15
7.3.40.0000.01215.22
7.3.30.0060.00915.13
7.3.20.0060.01217.10
7.3.10.0110.00016.89
7.3.00.0090.00516.94
7.2.330.0120.00917.14
7.2.320.0120.00917.02
7.2.310.0110.00717.16
7.2.300.0100.00616.83
7.2.290.0000.02016.99
7.2.250.0030.01615.59
7.2.240.0060.01215.24
7.2.230.0070.01015.14
7.2.220.0000.01515.35
7.2.210.0070.00715.23
7.2.200.0060.00915.38
7.2.190.0060.01515.11
7.2.180.0090.00315.09
7.2.170.0090.00315.31
7.2.130.0030.01217.25
7.2.120.0100.00717.27
7.2.110.0070.00717.28
7.2.100.0040.01117.25
7.2.90.0060.00617.04
7.2.80.0040.01116.93
7.2.70.0100.00317.27
7.2.60.0000.01317.13
7.2.50.0000.01117.18
7.2.40.0030.00817.27
7.2.30.0060.00817.36
7.2.20.0040.00817.23
7.2.10.0040.01117.37
7.2.00.0030.01118.27
7.1.330.0030.01316.23
7.1.320.0030.00916.07
7.1.310.0040.01116.10
7.1.300.0040.01115.93
7.1.290.0040.00816.04
7.1.280.0000.01716.10
7.1.270.0030.01016.05
7.1.260.0040.01416.21
7.1.250.0000.01815.86
7.1.240.0070.01016.21
7.1.230.0000.01316.20
7.1.220.0120.00015.98
7.1.210.0060.01016.19
7.1.200.0030.00916.14
7.1.190.0000.01416.16
7.1.180.0060.00915.96
7.1.170.0030.01316.06
7.1.160.0060.00915.96
7.1.150.0040.00816.14
7.1.140.0070.00716.09
7.1.130.0030.00716.07
7.1.120.0060.00615.77
7.1.110.0030.01216.24
7.1.100.0040.00917.28
7.1.90.0030.00716.18
7.1.80.0030.01016.14
7.1.70.0090.00316.80
7.1.60.0100.00917.68
7.1.50.0070.01216.43
7.1.40.0080.00516.03
7.1.30.0060.00816.00
7.1.20.0060.01016.08
7.1.10.0030.01016.17
7.1.00.0030.02719.08
7.0.330.0080.00315.34
7.0.320.0040.01115.34
7.0.310.0090.00315.50
7.0.300.0040.00715.65
7.0.290.0000.00815.32
7.0.280.0030.01315.75
7.0.270.0030.00915.73
7.0.260.0000.01115.59
7.0.250.0090.00315.59
7.0.240.0000.00815.43
7.0.230.0040.01115.45
7.0.220.0060.00315.39
7.0.210.0040.00715.52
7.0.200.0060.00516.20
7.0.190.0060.00315.36
7.0.180.0000.01315.39
7.0.170.0030.00615.58
7.0.160.0000.00815.29
7.0.150.0040.01115.45
7.0.140.0020.04418.74
7.0.130.0090.00615.12
7.0.120.0000.01315.30
7.0.110.0040.01115.33
7.0.100.0000.04517.67
7.0.90.0070.04017.72
7.0.80.0030.04717.78
7.0.70.0090.04317.76
7.0.60.0070.04017.85
7.0.50.0050.03017.93
7.0.40.0030.04016.72
7.0.30.0100.04016.93
7.0.20.0090.04916.88
7.0.10.0070.03816.89
7.0.00.0050.04416.77
5.6.380.0110.00314.56
5.6.370.0090.00314.58
5.6.360.0120.00014.48
5.6.350.0060.00614.72
5.6.340.0060.00914.84
5.6.330.0090.00614.49
5.6.320.0100.00014.75
5.6.310.0000.01614.57
5.6.300.0080.00815.00
5.6.290.0140.00014.82
5.6.280.0050.03917.66
5.6.270.0030.01014.40
5.6.260.0030.00614.58
5.6.250.0140.03817.50
5.6.240.0080.04017.72
5.6.230.0100.03117.65
5.6.220.0070.03717.64
5.6.210.0100.03717.60
5.6.200.0030.03417.87
5.6.190.0100.03617.85
5.6.180.0100.04217.94
5.6.170.0070.04617.79
5.6.160.0060.04317.99
5.6.150.0080.04317.87
5.6.140.0080.03717.82
5.6.130.0070.02918.02
5.6.120.0100.04017.87
5.6.110.0070.04117.70
5.6.100.0070.04217.88
5.6.90.0130.04017.91
5.6.80.0100.01817.53
5.6.70.0080.02317.51
5.6.60.0070.03417.43
5.6.50.0050.04217.36
5.6.40.0030.02717.49
5.6.30.0070.03817.54
5.6.20.0050.03917.56
5.6.10.0050.03917.63
5.6.00.0060.04617.50
5.5.380.0100.04516.07
5.5.370.0030.02715.80
5.5.360.0070.04215.94
5.5.350.0100.03816.01
5.5.340.0020.03016.31
5.5.330.0030.04116.15
5.5.320.0020.04316.20
5.5.310.0050.04016.19
5.5.300.0050.04816.30
5.5.290.0050.04316.11
5.5.280.0100.04216.11
5.5.270.0080.02516.27
5.5.260.0050.02816.11
5.5.250.0000.03216.02
5.5.240.0020.02515.73
5.5.230.0050.04915.86
5.5.220.0030.04315.96
5.5.210.0020.04315.93
5.5.200.0060.03115.80
5.5.190.0050.04015.81
5.5.180.0080.03215.80
5.5.170.0030.00611.61
5.5.160.0050.04315.59
5.5.150.0050.04615.89
5.5.140.0020.03815.84
5.5.130.0070.02515.87
5.5.120.0100.02115.73
5.5.110.0080.04315.82
5.5.100.0050.04015.72
5.5.90.0100.02015.70
5.5.80.0030.02715.78
5.5.70.0030.02915.82
5.5.60.0050.04215.81
5.5.50.0090.02215.68
5.5.40.0050.02515.79
5.5.30.0060.03715.71
5.5.20.0090.03515.67
5.5.10.0030.03515.77
5.5.00.0030.02615.84
5.4.450.0040.04715.35
5.4.440.0010.04615.44
5.4.430.0090.02015.32
5.4.420.0100.03615.39
5.4.410.0040.04215.49
5.4.400.0080.03815.16
5.4.390.0060.04015.30
5.4.380.0020.04215.11
5.4.370.0040.03315.33
5.4.360.0020.02315.15
5.4.350.0030.02415.27
5.4.340.0070.02515.12
5.4.330.0070.00711.39
5.4.320.0070.03915.18
5.4.310.0070.03515.16
5.4.300.0100.02815.15
5.4.290.0120.03315.35
5.4.280.0060.04515.13
5.4.270.0070.01915.17
5.4.260.0100.03515.10
5.4.250.0060.03515.28
5.4.240.0110.03215.15
5.4.230.0110.03115.11
5.4.220.0030.04015.11
5.4.210.0070.04015.14
5.4.200.0020.04015.20
5.4.190.0050.02315.27
5.4.180.0080.03815.17
5.4.170.0070.03715.29
5.4.160.0080.04015.16
5.4.150.0070.03715.14
5.4.140.0030.03813.84
5.4.130.0070.03513.82
5.4.120.0090.03013.93
5.4.110.0080.03313.89
5.4.100.0080.04014.00
5.4.90.0090.03713.78
5.4.80.0050.03913.97
5.4.70.0050.04113.85
5.4.60.0030.02713.99
5.4.50.0050.04113.75
5.4.40.0020.02914.04
5.4.30.0030.04413.88
5.4.20.0120.02713.92
5.4.10.0050.03813.91
5.4.00.0050.04413.59
5.3.290.0070.03713.01
5.3.280.0080.02113.01
5.3.270.0060.03013.01
5.3.260.0040.02413.01
5.3.250.0050.02913.01
5.3.240.0080.02713.01
5.3.230.0030.02713.01
5.3.220.0080.02513.01
5.3.210.0130.03313.01
5.3.200.0130.02213.01
5.3.190.0070.02513.01
5.3.180.0120.03713.01
5.3.170.0000.04313.01
5.3.160.0020.04413.01
5.3.150.0050.02613.01
5.3.140.0080.03313.01
5.3.130.0080.02613.01
5.3.120.0050.04313.01
5.3.110.0060.02313.01
5.3.100.0050.03413.01
5.3.90.0040.03813.01
5.3.80.0080.01813.01
5.3.70.0050.02213.01
5.3.60.0080.04013.01
5.3.50.0030.04013.01
5.3.40.0080.02213.01
5.3.30.0080.03213.01
5.3.20.0030.03113.01
5.3.10.0050.01913.01
5.3.00.0030.04113.01
5.2.170.0090.02713.01
5.2.160.0070.03113.01
5.2.150.0080.02813.01
5.2.140.0010.03613.01
5.2.130.0030.03313.01
5.2.120.0010.03013.01
5.2.110.0020.03513.01
5.2.100.0020.02313.01
5.2.90.0050.03213.01
5.2.80.0000.02413.01
5.2.70.0030.03613.01
5.2.60.0050.01513.01
5.2.50.0030.03213.01
5.2.40.0050.02913.01
5.2.30.0070.01513.01
5.2.20.0040.02513.01
5.2.10.0070.03013.01
5.2.00.0080.03013.01
5.1.60.0030.02813.01
5.1.50.0030.02613.01
5.1.40.0020.03313.01
5.1.30.0050.02313.01
5.1.20.0050.03013.01
5.1.10.0030.01813.01
5.1.00.0030.03013.01
5.0.50.0050.02113.01
5.0.40.0030.02413.01
5.0.30.0020.03313.01
5.0.20.0020.02113.01
5.0.10.0020.02313.01
5.0.00.0040.02613.01
4.4.90.0030.01013.01
4.4.80.0020.02113.01
4.4.70.0020.02213.01
4.4.60.0020.02013.01
4.4.50.0020.02013.01
4.4.40.0030.02013.01
4.4.30.0040.01813.01
4.4.20.0000.01913.01
4.4.10.0030.01813.01
4.4.00.0040.02213.01
4.3.110.0030.01813.01
4.3.100.0000.02113.01
4.3.90.0090.00713.01
4.3.80.0050.02813.01
4.3.70.0020.01813.01
4.3.60.0010.02113.01
4.3.50.0030.01913.01
4.3.40.0020.02913.01
4.3.30.0030.01813.01
4.3.20.0010.01813.01
4.3.10.0010.01113.01
4.3.00.0020.01813.01

preferences:
44.7 ms | 401 KiB | 5 Q