3v4l.org

run code in 300+ PHP versions simultaneously
<?php class InterestCalculator { private array $dailyInterest = []; private static int $interest = 89; public function calculateDailyInterest(string $start, string $end): array { $this->dailyInterest = array_fill(0, date_diff(date_create($start), date_create($end))->format('%a'), self::$interest); $total = array_sum($this->dailyInterest); array_walk($this->dailyInterest, function (int &$value, int $key): void { $value = ($this->dailyInterest[$key -1] ?? 0) + $value; }); return compact('total') + ['dailyInterest' => $this->dailyInterest]; } } print_r((new InterestCalculator)->calculateDailyInterest('2022-06-06', '2023-06-04'));

Abusive script

This script was stopped while abusing our resources

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.110.0060.00316.88
8.3.100.0130.00316.75
8.3.90.0090.00626.77
8.3.80.0110.00016.63
8.3.70.0120.00316.75
8.3.60.0200.00018.68
8.3.50.0100.01020.34
8.3.40.0190.00319.08
8.3.30.0070.00719.34
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.230.0000.00920.94
8.2.220.0030.00724.06
8.2.210.0030.00726.77
8.2.200.0030.00616.63
8.2.190.0160.00616.75
8.2.180.0040.01125.92
8.2.170.0110.00719.33
8.2.160.0070.00722.96
8.2.150.0000.00725.66
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0000.00720.07
8.2.110.0090.00722.13
8.2.100.0070.01018.64
8.2.90.0090.00618.77
8.2.80.0160.00018.66
8.2.70.0090.00818.64
8.2.60.0080.00818.73
8.2.50.0100.00618.65
8.2.40.0020.00819.63
8.2.30.0070.00518.73
8.2.20.0060.00319.78
8.2.10.0070.00418.56
8.2.00.0100.00519.33
8.1.290.0030.00630.84
8.1.280.0100.01025.92
8.1.270.0050.00323.99
8.1.260.0070.00326.35
8.1.250.0000.00828.09
8.1.240.0100.00621.37
8.1.230.0090.00620.84
8.1.220.0120.00518.37
8.1.210.0080.00619.62
8.1.200.0080.00218.26
8.1.190.0070.00818.21
8.1.180.0040.00518.43
8.1.170.0090.00618.69
8.1.160.0080.00518.99
8.1.150.0100.00318.94
8.1.140.0080.00518.34
8.1.130.0100.00318.95
8.1.120.0020.01118.24
8.1.110.0060.00818.27
8.1.100.0090.00018.21
8.1.90.0070.00818.25
8.1.80.0040.00518.32
8.1.70.0060.00318.23
8.1.60.0080.00718.33
8.1.50.0080.00419.09
8.1.40.0080.00818.29
8.1.30.0050.01018.47
8.1.20.0080.00718.31
8.1.10.0060.00918.26
8.1.00.0090.00518.26
8.0.300.0040.00519.18
8.0.290.0030.00517.54
8.0.280.0050.00518.39
8.0.270.0020.00718.52
8.0.260.0030.00719.16
8.0.250.0040.00518.61
8.0.240.0040.00518.60
8.0.230.0060.00818.56
8.0.220.0050.00317.63
8.0.210.0070.00117.61
8.0.200.0030.00517.72
8.0.190.0090.00317.76
8.0.180.0150.00317.78
8.0.170.0120.00217.73
8.0.160.0110.00717.74
8.0.150.0090.00417.66
8.0.140.0070.00517.66
8.0.130.0100.00617.65
8.0.120.0050.00817.64
8.0.110.0090.00517.71
8.0.100.0080.00417.64
8.0.90.0130.00517.59
8.0.80.0070.00517.64
8.0.70.0070.00917.65
8.0.60.0110.00217.66
8.0.50.0150.00417.63
8.0.30.0100.00717.67
8.0.20.0110.00617.74
8.0.10.0130.00317.87
7.4.330.0060.00414.67
7.4.320.0050.00917.26
7.4.300.0120.00817.14
7.4.290.0160.00217.24
7.4.280.0140.00417.19
7.4.270.0120.00317.14
7.4.260.0120.00717.33
7.4.250.0050.00718.12
7.4.240.0060.00518.12
7.4.230.0070.00417.21
7.4.220.0080.00417.19
7.4.210.0090.00017.31
7.4.200.0050.00417.12
7.4.190.0050.00517.15
7.4.180.0060.00417.27
7.4.160.0090.00217.26
7.4.150.0120.00517.29
7.4.140.0110.00717.15
7.4.130.0090.00817.15
7.4.120.0050.00817.16
7.4.110.0190.00717.08
7.4.100.0130.00717.13
7.4.90.0120.00817.12
7.4.80.0230.00417.18
7.4.70.0210.00717.10
7.4.60.0210.00417.17
7.4.50.0240.00317.12
7.4.40.0210.00616.84
7.4.30.0130.00417.24
7.4.20.0180.00417.05
7.4.10.0130.00317.14
7.4.00.0120.00517.22

preferences:
105.17 ms | 403 KiB | 5 Q