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, 1417737600); 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.0080.00818.51
8.3.50.0100.00921.20
8.3.40.0180.00319.27
8.3.30.0000.01320.29
8.3.20.0080.00320.33
8.3.10.0080.00022.21
8.3.00.0090.00022.38
8.2.180.0150.00417.00
8.2.170.0080.00822.96
8.2.160.0100.00322.25
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0000.00720.99
8.2.110.0040.00821.21
8.2.100.0070.00418.21
8.2.90.0060.00318.13
8.2.80.0030.01018.05
8.2.70.0060.00318.18
8.2.60.0050.00318.29
8.2.50.0040.00418.10
8.2.40.0000.00820.58
8.2.30.0000.00819.68
8.2.20.0000.00718.15
8.2.10.0030.00618.05
8.2.00.0060.00318.10
8.1.280.0030.01225.92
8.1.270.0120.00323.99
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0050.00524.15
8.1.230.0040.00719.34
8.1.220.0040.00418.02
8.1.210.0000.00918.77
8.1.200.0030.00617.72
8.1.190.0040.00417.61
8.1.180.0040.00418.10
8.1.170.0000.00819.02
8.1.160.0050.00319.09
8.1.150.0000.00719.05
8.1.140.0000.00717.90
8.1.130.0050.00217.99
8.1.120.0040.00417.86
8.1.110.0040.00417.73
8.1.100.0030.00517.73
8.1.90.0000.00717.90
8.1.80.0000.00717.68
8.1.70.0030.00317.68
8.1.60.0080.00017.91
8.1.50.0080.00017.85
8.1.40.0040.00417.67
8.1.30.0000.00817.85
8.1.20.0000.00817.98
8.1.10.0000.00717.96
8.1.00.0000.00817.75
8.0.300.0000.00720.11
8.0.290.0000.00817.25
8.0.280.0040.00418.65
8.0.270.0030.00317.46
8.0.260.0030.00317.27
8.0.250.0000.00717.48
8.0.240.0000.00817.45
8.0.230.0040.00417.35
8.0.220.0030.00317.37
8.0.210.0050.00217.23
8.0.200.0030.00317.39
8.0.190.0000.00917.43
8.0.180.0040.00417.39
8.0.170.0030.00517.42
8.0.160.0000.00717.32
8.0.150.0000.00717.29
8.0.140.0040.00417.18
8.0.130.0030.00313.71
8.0.120.0040.00417.18
8.0.110.0000.00717.25
8.0.100.0000.00817.13
8.0.90.0040.00417.20
8.0.80.0090.00617.34
8.0.70.0030.00717.14
8.0.60.0040.00417.39
8.0.50.0040.00417.20
8.0.30.0080.01217.45
8.0.20.0140.00817.64
8.0.10.0030.00517.32
8.0.00.0140.00817.01
7.4.330.0000.00516.82
7.4.320.0030.00316.74
7.4.300.0000.00616.72
7.4.290.0040.00416.92
7.4.280.0030.00316.92
7.4.270.0030.00316.90
7.4.260.0000.00613.48
7.4.250.0030.00516.64
7.4.240.0060.00216.93
7.4.230.0000.00716.93
7.4.220.0040.01516.86
7.4.210.0080.00916.95
7.4.200.0070.00016.91
7.4.190.0000.00716.91
7.4.160.0120.00816.95
7.4.150.0060.01217.40
7.4.140.0110.00917.86
7.4.130.0140.00516.84
7.4.120.0080.01017.05
7.4.110.0110.01116.94
7.4.100.0090.01016.96
7.4.90.0100.00716.88
7.4.80.0160.00319.39
7.4.70.0080.00816.63
7.4.60.0030.01316.85
7.4.50.0080.00016.81
7.4.40.0090.00622.77
7.4.30.0140.00916.86
7.4.00.0060.01115.34
7.3.330.0000.00513.57
7.3.320.0030.00313.49
7.3.310.0000.00716.55
7.3.300.0070.00016.52
7.3.290.0060.00616.71
7.3.280.0100.00816.64
7.3.270.0110.00917.40
7.3.260.0070.01418.24
7.3.250.0130.00616.81
7.3.240.0040.01216.63
7.3.230.0100.01016.76
7.3.210.0180.00316.57
7.3.200.0100.00719.39
7.3.190.0030.01416.70
7.3.180.0070.01416.64
7.3.170.0100.00716.77
7.3.160.0060.00916.80
7.3.120.0040.01115.20
7.3.10.0060.01016.95
7.3.00.0060.00316.68
7.2.330.0080.00816.95
7.2.320.0120.00917.08
7.2.310.0140.00317.04
7.2.300.0040.01217.16
7.2.290.0130.00717.16
7.2.130.0040.01117.25
7.2.120.0000.01416.93
7.2.110.0220.00616.56
7.2.100.0350.00516.83
7.2.90.0240.00716.95
7.2.80.0250.00817.03
7.2.70.0120.00816.85
7.2.60.0130.00717.02
7.2.50.0210.00917.08
7.2.40.0260.00516.95
7.2.30.0060.00816.93
7.2.20.0100.00517.11
7.2.10.0050.00917.18
7.2.00.0080.00717.81
7.1.250.0040.00716.16
7.1.230.0410.00715.74
7.1.220.0470.00415.49
7.1.210.0570.00015.73
7.1.200.0420.01215.62
7.1.190.0270.00615.82
7.1.180.0310.00015.91
7.1.170.0340.00915.62
7.1.160.0130.00615.89
7.1.150.0220.00015.60
7.1.140.0070.00715.86
7.1.130.0100.00715.64
7.1.120.0090.00315.57
7.1.110.0120.00815.99
7.1.100.0060.00917.05
7.1.90.0060.00616.02
7.1.80.0060.01616.03
7.1.70.0070.00716.31
7.1.60.0110.01117.51
7.1.50.0120.01016.31
7.1.40.0120.00815.91
7.1.30.2030.00715.96
7.1.20.0120.01216.00
7.1.10.0130.00315.52
7.1.00.0080.04319.12
7.0.310.0390.00715.46
7.0.300.0130.01315.38
7.0.290.0100.01015.06
7.0.280.0110.00015.26
7.0.270.0060.00615.42
7.0.260.0200.00015.55
7.0.250.0060.00615.29
7.0.240.0100.00715.26
7.0.230.0040.00415.41
7.0.220.0120.00615.30
7.0.210.0080.00315.42
7.0.200.0080.00516.19
7.0.190.0070.01015.30
7.0.180.0120.00915.38
7.0.170.0110.00415.12
7.0.160.0120.00315.43
7.0.150.0030.00915.23
7.0.140.0090.03418.50
7.0.130.0120.00615.18
7.0.120.0150.00615.38
7.0.110.0050.00915.34
7.0.100.0090.00614.97
7.0.90.0130.04017.51
7.0.80.0140.03717.41
7.0.70.0070.02817.86
7.0.60.0110.04517.87
7.0.50.0110.04517.87
7.0.40.0160.02816.85
7.0.30.0070.03916.83
7.0.20.0170.03516.80
7.0.10.0100.03116.88
7.0.00.0120.04516.83
5.6.380.0430.00614.30
5.6.370.0280.01414.20
5.6.360.0140.00614.35
5.6.350.0120.00614.46
5.6.340.0020.00714.31
5.6.330.0030.01314.72
5.6.320.0020.00814.30
5.6.310.0130.00314.76
5.6.300.0150.00014.61
5.6.290.0080.00814.66
5.6.280.0080.03817.67
5.6.270.0100.00714.32
5.6.260.0100.00314.34
5.6.250.0080.00414.41
5.6.240.0040.04817.59
5.6.230.0080.03817.33
5.6.220.0090.04417.71
5.6.210.0070.03417.55
5.6.200.0110.04017.73
5.6.190.0110.02517.95
5.6.180.0110.04217.74
5.6.170.0160.04017.80
5.6.160.0130.04317.83
5.6.150.0080.04217.83
5.6.140.0190.04017.78
5.6.130.0100.03217.99
5.6.120.0070.03518.03
5.6.110.0100.03617.89
5.6.100.0080.03717.72
5.6.90.0120.02817.89
5.6.80.0090.04617.25
5.6.70.0070.04217.54
5.6.60.0050.04217.35
5.6.50.0100.03517.44
5.6.40.0030.04617.29
5.6.30.0070.03117.29
5.6.20.0100.02417.32
5.6.10.0050.03517.33
5.6.00.0110.04217.42
5.5.380.0070.02215.76
5.5.370.0050.04915.47
5.5.360.0100.03415.99
5.5.350.0090.04515.94
5.5.340.0090.04516.08
5.5.330.0110.02116.18
5.5.320.0100.04016.12
5.5.310.0090.03116.01
5.5.300.0090.03016.09
5.5.290.0060.03816.11
5.5.280.0050.02816.10
5.5.270.0060.03116.21
5.5.260.0070.05016.19
5.5.250.0060.04316.01
5.5.240.0100.02715.56
5.5.230.0090.04215.80
5.5.220.0080.02315.80
5.5.210.0070.04015.85
5.5.200.0170.03015.64
5.5.190.0100.02215.74
5.5.180.0030.04415.77
5.5.170.0120.00614.48
5.5.160.0090.03615.54
5.5.150.0070.04115.68
5.5.140.0110.02815.76
5.5.130.0090.02915.66
5.5.120.0080.04215.55
5.5.110.0030.04615.49
5.5.100.0070.04815.48
5.5.90.0070.03015.67
5.5.80.0070.02415.62
5.5.70.0070.02015.57
5.5.60.0080.02115.62
5.5.50.0060.02015.79
5.5.40.0040.02615.58
5.5.30.0100.01815.84
5.5.20.0070.02215.61
5.5.10.0180.03415.74
5.5.00.0090.04415.67
5.4.450.0130.03315.49
5.4.440.0090.04115.33
5.4.430.0100.04115.56
5.4.420.0140.03815.35
5.4.410.0150.03415.10
5.4.400.0030.03315.15
5.4.390.0090.04015.13
5.4.380.0080.02215.14
5.4.370.0050.02115.35
5.4.360.0080.03315.30
5.4.350.0120.02815.07
5.4.340.0130.02814.99
5.4.330.0030.00811.05
5.4.320.0080.03515.06
5.4.310.0020.04115.12
5.4.300.0070.04115.23
5.4.290.0050.03015.12
5.4.280.0060.03815.14
5.4.270.0030.04615.09
5.4.260.0100.01815.24
5.4.250.0090.03515.21
5.4.240.0100.03715.07
5.4.230.0120.03315.11
5.4.220.0060.04115.09
5.4.210.0090.02115.13
5.4.200.0050.02115.09
5.4.190.0050.04115.19
5.4.180.0030.02315.09
5.4.170.0110.04015.18
5.4.160.0100.04015.03
5.4.150.0070.03715.21
5.4.140.0070.02513.85
5.4.130.0050.02613.81
5.4.120.0030.02513.90
5.4.110.0100.03013.71
5.4.100.0100.03613.72
5.4.90.0060.04113.78
5.4.80.0130.03713.89
5.4.70.0160.03213.93
5.4.60.0100.03013.96
5.4.50.0160.03313.96
5.4.40.0080.03913.71
5.4.30.0130.03613.77
5.4.20.0140.03513.96
5.4.10.0080.04313.83
5.4.00.0060.03213.70
5.3.290.0100.03212.95
5.3.280.0080.03612.72
5.3.270.0050.03712.89
5.3.260.0090.03912.89
5.3.250.0080.03912.83
5.3.240.0040.03812.80
5.3.230.0050.04212.84
5.3.220.0090.03812.77
5.3.210.0030.03212.81
5.3.200.0070.04212.81
5.3.190.0080.03812.84
5.3.180.0070.02512.88
5.3.170.0130.04112.87
5.3.160.0050.03212.87
5.3.150.0090.04112.87
5.3.140.0090.02312.84
5.3.130.0130.03812.86
5.3.120.0080.04212.83
5.3.110.0090.02412.89
5.3.100.0050.04512.84
5.3.90.0040.04212.73
5.3.80.0070.03812.79
5.3.70.0080.03612.79
5.3.60.0050.02112.77
5.3.50.0040.02312.79
5.3.40.0040.03112.80
5.3.30.0100.03512.86
5.3.20.0120.03212.78
5.3.10.0050.04112.67
5.3.00.0060.03312.70
5.2.170.0060.03312.38
5.2.160.0030.03112.39
5.2.150.0050.03712.38
5.2.140.0110.02912.19
5.2.130.0030.02312.08
5.2.120.0050.03812.27
5.2.110.0080.03012.27
5.2.100.0090.02912.26
5.2.90.0070.02512.12
5.2.80.0040.03112.05
5.2.70.0030.03212.08
5.2.60.0080.02612.14
5.2.50.0050.03512.13
5.2.40.0080.03012.24
5.2.30.0040.03712.20
5.2.20.0080.02412.15
5.2.10.0040.02312.01
5.2.00.0080.01612.10
5.1.60.0040.02811.78
5.1.50.0070.02011.78
5.1.40.0030.01811.86
5.1.30.0050.02611.90
5.1.20.0060.02311.79
5.1.10.0070.02711.78
5.1.00.0090.02511.78
5.0.50.0030.01711.78
5.0.40.0080.01111.78
5.0.30.0050.03311.78
5.0.20.0070.02011.78
5.0.10.0090.01811.78
5.0.00.0050.03711.78
4.4.90.0070.01311.78
4.4.80.0020.01911.78
4.4.70.0040.01611.78
4.4.60.0060.01511.78
4.4.50.0050.01611.78
4.4.40.0050.02811.78
4.4.30.0020.02311.78
4.4.20.0000.02111.78
4.4.10.0060.01711.78
4.4.00.0000.02111.78
4.3.110.0080.01511.78
4.3.100.0090.01211.78
4.3.90.0040.01711.78
4.3.80.0040.03111.78
4.3.70.0040.01511.78
4.3.60.0060.01411.78
4.3.50.0020.01811.78
4.3.40.0040.02111.78
4.3.30.0010.01111.78
4.3.20.0020.02011.78
4.3.10.0040.01811.78
4.3.00.0010.01811.78

preferences:
43.16 ms | 401 KiB | 5 Q