3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calcDays($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $i[0] = 60; $i[1] = 24; $i[2] = 7; $i[3] = date('t', strtotime('-1 month', $second)); $i[4] = date('L', strtotime('-1 year', $second)) ? 366 : 365; $i[5] = array(31, (date('L', strtotime('-1 year', $second)) ? 28 : 29), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $days = 0; for($n = 0; $n < 12; $n++) { $temp = floor($inbetween / $i[0] / $i[0] / $i[1]); var_dump($temp); $tempMonth = date('n', strtotime('-1 year', $second)) - 1; if($temp >= $i[5][$tempMonth]) { $temp -= $i[5][$tempMonth]; var_dump($temp); } else { $days = $temp; var_dump($days); break; } } $month = floor($inbetween / $i[0] / $i[0] / $i[1] / $i[3] % $i[4]); //$days = floor($inbetween / $i[0] / $i[0] / $i[1] % $i[3]); $hours = floor($inbetween / $i[0] / $i[0] % $i[1]); $minutes = floor($inbetween / $i[0] % $i[0]); $seconds = $inbetween % $i[0]; return $month . " " . $days . " " . $hours . " " . $minutes . " " . $seconds . " " . $inbetween; } echo calcDays(1388389157, 1419925156);

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.0090.00918.93
8.3.50.0220.01121.33
8.3.40.0070.01119.39
8.3.30.0110.00420.34
8.3.20.0040.00420.46
8.3.10.0050.00321.86
8.3.00.0080.00022.52
8.2.180.0150.00317.13
8.2.170.0110.00722.96
8.2.160.0070.00722.21
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0030.00520.88
8.2.110.0040.00419.58
8.2.100.0120.00018.28
8.2.90.0040.00419.30
8.2.80.0050.00318.18
8.2.70.0030.00618.00
8.2.60.0000.00818.18
8.2.50.0040.00418.07
8.2.40.0040.00418.40
8.2.30.0030.00519.59
8.2.20.0060.00318.05
8.2.10.0030.00618.02
8.2.00.0040.00418.07
8.1.280.0110.00425.92
8.1.270.0060.00323.99
8.1.260.0070.00026.35
8.1.250.0090.00028.09
8.1.240.0090.00024.04
8.1.230.0080.00421.09
8.1.220.0000.00818.77
8.1.210.0080.00020.88
8.1.200.0050.00517.38
8.1.190.0060.00317.75
8.1.180.0050.00318.10
8.1.170.0000.00818.70
8.1.160.0040.00419.17
8.1.150.0070.00019.05
8.1.140.0050.00317.86
8.1.130.0030.00318.12
8.1.120.0070.00017.75
8.1.110.0040.00417.79
8.1.100.0000.00717.79
8.1.90.0030.00617.81
8.1.80.0030.00517.75
8.1.70.0070.00017.78
8.1.60.0050.00317.93
8.1.50.0070.00017.71
8.1.40.0000.00817.67
8.1.30.0040.00417.86
8.1.20.0030.00517.92
8.1.10.0040.00417.88
8.1.00.0040.00417.88
8.0.300.0000.00720.14
8.0.290.0040.00417.53
8.0.280.0050.00318.54
8.0.270.0030.00317.40
8.0.260.0030.00318.68
8.0.250.0030.00317.39
8.0.240.0040.00417.41
8.0.230.0000.00817.37
8.0.220.0000.00717.27
8.0.210.0000.00717.20
8.0.200.0070.00017.29
8.0.190.0080.00017.41
8.0.180.0040.00417.34
8.0.170.0040.00417.41
8.0.160.0040.00417.29
8.0.150.0000.00717.14
8.0.140.0050.00217.20
8.0.130.0000.00613.63
8.0.120.0080.00017.31
8.0.110.0040.00417.15
8.0.100.0030.00617.34
8.0.90.0000.00817.21
8.0.80.0100.01017.32
8.0.70.0070.00017.21
8.0.60.0070.00017.21
8.0.50.0040.00417.14
8.0.30.0120.00717.54
8.0.20.0130.00817.53
8.0.10.0050.00217.47
8.0.00.0070.01317.06
7.4.330.0020.00216.96
7.4.320.0040.00416.90
7.4.300.0030.00316.79
7.4.290.0030.00316.95
7.4.280.0000.00716.79
7.4.270.0000.00716.73
7.4.260.0000.00613.45
7.4.250.0000.01016.86
7.4.240.0070.00116.87
7.4.230.0030.00416.77
7.4.220.0160.01016.81
7.4.210.0060.01016.91
7.4.200.0050.00316.74
7.4.190.0040.00416.98
7.4.160.0120.01216.69
7.4.150.0120.00617.40
7.4.140.0130.00817.86
7.4.130.0160.00416.74
7.4.120.0080.01016.78
7.4.110.0090.00916.76
7.4.100.0070.01116.84
7.4.90.0120.00616.74
7.4.80.0130.00419.39
7.4.70.0100.00716.68
7.4.60.0100.00716.78
7.4.50.0000.00916.76
7.4.40.0070.01122.77
7.4.30.0100.00716.77
7.4.00.0070.00815.04
7.3.330.0000.00513.46
7.3.320.0000.00513.47
7.3.310.0050.00316.64
7.3.300.0060.00316.59
7.3.290.0070.00716.64
7.3.280.0100.00916.60
7.3.270.0130.01017.40
7.3.260.0130.01218.24
7.3.250.0110.01116.82
7.3.240.0120.00616.73
7.3.230.0030.01516.82
7.3.210.0080.00816.63
7.3.200.0150.00319.39
7.3.190.0090.00816.65
7.3.180.0150.00016.74
7.3.170.0130.00316.84
7.3.160.0100.00616.85
7.3.120.0030.01415.16
7.3.110.0060.01015.20
7.3.100.0000.01015.17
7.3.90.0130.00315.35
7.3.80.0070.01014.97
7.3.70.0030.00915.11
7.3.60.0110.00615.18
7.3.50.0030.00915.02
7.3.40.0040.01214.77
7.3.30.0110.00614.81
7.3.20.0030.01016.70
7.3.10.0100.00716.85
7.3.00.0130.00616.87
7.2.330.0080.01117.06
7.2.320.0090.01217.18
7.2.310.0090.00916.98
7.2.300.0060.01217.16
7.2.290.0110.00716.83
7.2.250.0100.00715.50
7.2.240.0100.01015.29
7.2.230.0000.01515.37
7.2.220.0060.00315.57
7.2.210.0060.00615.24
7.2.200.0070.01115.47
7.2.190.0170.00015.13
7.2.180.0140.00315.41
7.2.170.0090.00315.32
7.2.130.0220.00016.99
7.2.120.0110.00716.66
7.2.110.0110.01116.94
7.2.100.0080.00617.07
7.2.90.0120.00817.00
7.2.80.0210.01416.77
7.2.70.0250.00316.68
7.2.60.0090.00916.55
7.2.50.0120.00817.00
7.2.40.0160.00717.08
7.2.30.0040.01417.09
7.2.20.0100.00717.20
7.2.10.0110.00716.96
7.2.00.0030.01118.39
7.1.330.0110.00416.12
7.1.320.0040.01115.87
7.1.310.0060.01016.17
7.1.300.0060.00615.85
7.1.290.0080.00816.19
7.1.280.0030.00915.77
7.1.270.0030.00916.11
7.1.260.0000.01315.91
7.1.250.0060.01216.00
7.1.100.0030.00818.05
7.1.70.0100.00317.39
7.1.60.0070.01019.17
7.1.50.0110.01517.03
7.1.00.0030.03322.36
7.0.200.0060.00317.02
7.0.140.0000.07722.04
7.0.80.0570.08319.93
7.0.70.0500.04719.93
7.0.60.0530.07019.99
7.0.50.0600.06720.43
7.0.40.0170.08020.08
7.0.30.0130.08020.04
7.0.20.0130.07720.18
7.0.10.0030.08720.02
7.0.00.0070.08720.13
5.6.280.0070.07021.16
5.6.230.0100.08320.55
5.6.220.0170.07320.60
5.6.210.0130.07720.50
5.6.200.0070.08720.98
5.6.190.0170.06021.04
5.6.180.0070.05720.98
5.6.170.0100.06721.16
5.6.160.0130.08021.10
5.6.150.0030.06321.12
5.6.140.0030.09021.05
5.6.130.0000.09021.10
5.6.120.0200.03321.02
5.6.110.0070.07320.97
5.6.100.0070.06321.01
5.6.90.0100.06320.96
5.6.80.0100.08020.35
5.6.70.0070.08020.42
5.6.60.0100.07320.46
5.6.50.0130.05720.46
5.6.40.0070.05320.49
5.6.30.0030.04020.31
5.6.20.0130.07020.36
5.6.10.0100.07720.35
5.6.00.0200.07020.47
5.5.370.0030.07320.41
5.5.360.0030.04720.55
5.5.350.0070.08720.36
5.5.340.0130.07320.78
5.5.330.0070.08720.95
5.5.320.0200.07020.86
5.5.310.0000.09020.88
5.5.300.0170.07320.88
5.5.290.0170.08020.75
5.5.280.0130.07720.89
5.5.270.0100.04020.84
5.5.260.0000.05720.93
5.5.250.0030.05020.59
5.5.240.0070.06720.14
5.5.230.0130.05020.27
5.5.220.0130.06720.17
5.5.210.0170.07020.22
5.5.200.0030.06320.30
5.5.190.0130.06320.10
5.5.180.0030.08720.23
5.5.160.0200.07020.26
5.5.150.0000.08720.24
5.5.140.0130.07320.24
5.5.130.0070.05720.24
5.5.120.0030.04720.27
5.5.110.0070.05020.22
5.5.100.0130.03020.09
5.5.90.0030.08320.15
5.5.80.0100.07720.12
5.5.70.0070.07720.09
5.5.60.0030.08320.07
5.5.50.0130.07320.06
5.5.40.0170.06720.06
5.5.30.0130.06320.02
5.5.20.0070.07320.07
5.5.10.0100.03320.03
5.5.00.0030.08320.13
5.4.450.0070.08319.36
5.4.440.0130.04719.36
5.4.430.0070.08019.48
5.4.420.0030.07719.45
5.4.410.0130.07319.43
5.4.400.0030.06719.05
5.4.390.0130.07719.16
5.4.380.0100.07319.13
5.4.370.0070.08019.13
5.4.360.0100.05018.95
5.4.350.0000.04319.23
5.4.340.0070.07719.05
5.4.320.0130.06319.09
5.4.310.0100.04018.85
5.4.300.0070.08019.13
5.4.290.0070.08018.84
5.4.280.0070.08319.13
5.4.270.0030.04319.04
5.4.260.0030.04019.11
5.4.250.0030.04718.90
5.4.240.0200.06318.87
5.4.230.0170.06019.04
5.4.220.0030.07719.04
5.4.210.0100.06318.86
5.4.200.0070.06719.13
5.4.190.0070.07018.85
5.4.180.0100.03318.87
5.4.170.0070.07318.86
5.4.160.0070.07318.93
5.4.150.0100.07319.16
5.4.140.0070.06316.52
5.4.130.0070.07316.48
5.4.120.0030.07316.39
5.4.110.0070.07316.45
5.4.100.0100.05716.39
5.4.90.0070.07016.56
5.4.80.0100.07016.39
5.4.70.0100.03716.40
5.4.60.0070.08016.43
5.4.50.0000.07316.46
5.4.40.0070.06316.30
5.4.30.0100.07316.42
5.4.20.0100.06316.27
5.4.10.0130.05316.33
5.4.00.0070.07715.86
5.3.290.0070.03714.67
5.3.280.0100.07714.65
5.3.270.0030.05014.74
5.3.260.0070.07314.76
5.3.250.0030.07714.60
5.3.240.0030.07014.73
5.3.230.0130.07714.61
5.3.220.0170.06714.69
5.3.210.0030.07714.65
5.3.200.0030.08014.65
5.3.190.0030.07714.56
5.3.180.0130.07314.59
5.3.170.0030.07314.64
5.3.160.0070.07714.63
5.3.150.0100.07714.72
5.3.140.0100.07014.50
5.3.130.0100.04714.65
5.3.120.0030.08314.66
5.3.110.0100.05014.69
5.3.100.0030.08714.12
5.3.90.0130.06714.10
5.3.80.0070.07314.13
5.3.70.0130.06714.14
5.3.60.0030.05714.03
5.3.50.0100.03714.10
5.3.40.0170.05714.03
5.3.30.0070.07314.05
5.3.20.0070.07313.78
5.3.10.0030.04013.61
5.3.00.0070.07013.69
5.2.170.0030.03311.46
5.2.160.0070.06011.46
5.2.150.0030.06711.46
5.2.140.0070.06011.46
5.2.130.0070.06311.46
5.2.120.0030.04011.46
5.2.110.0030.06311.46
5.2.100.0030.04311.46
5.2.90.0100.05311.46
5.2.80.0030.04311.46
5.2.70.0070.05711.46
5.2.60.0100.05011.46
5.2.50.0000.06011.46
5.2.40.0100.05711.46
5.2.30.0100.04711.46
5.2.20.0000.06011.46
5.2.10.0030.05711.46
5.2.00.0070.06011.46
5.1.60.0070.05011.46
5.1.50.0030.05311.46
5.1.40.0000.05711.46
5.1.30.0000.06011.46
5.1.20.0100.05311.46
5.1.10.0030.05311.46
5.1.00.0100.05011.46
5.0.50.0070.04711.46
5.0.40.0000.04711.46
5.0.30.0070.06311.46
5.0.20.0070.03711.46
5.0.10.0000.05011.46
5.0.00.0100.06011.46
4.4.90.0070.03311.46
4.4.80.0030.03311.46
4.4.70.0070.03311.46
4.4.60.0070.03711.46
4.4.50.0100.02711.46
4.4.40.0030.05311.46
4.4.30.0000.04011.46
4.4.20.0030.03311.46
4.4.10.0130.02011.46
4.4.00.0030.05311.46
4.3.110.0130.02711.46
4.3.100.0000.02711.46
4.3.90.0000.03711.46
4.3.80.0030.05311.46
4.3.70.0000.04011.46
4.3.60.0030.03311.46
4.3.50.0000.03711.46
4.3.40.0030.05011.46
4.3.30.0030.03311.46
4.3.20.0000.02711.46
4.3.10.0000.02011.46
4.3.00.0130.02711.46

preferences:
41.81 ms | 400 KiB | 5 Q