3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Poll { private array $points; private RatingCost $cost; private array $votes = []; private array $votedUsers = []; public function __construct(array $points, RatingCost $cost, array $votes = [], array $votedUsers = []) { $this->points = $points; $this->cost = $cost; $this->votes = $votes; $this->votedUsers = $votedUsers; } public function vote(Vote $vote) { $this->votes[] = $vote; $votedUser = $vote->getUser(); $this->votedUsers[] = $votedUser; $votedUser->increaseRating($this->cost); } } class Vote { private User $user; private PollingPoint $point; public function __construct(User $user, PollingPoint $point) { $this->user = $user; $this->point = $point; } public function getUser() : User { return $this->user; } } class PollingPoint { private string $id; private string $value; public function __construct(string $id, string $value) { $this->id = $id; $this->value = $value; } } class User { private string $id; private Rating $rating; public function __construct(string $id, Rating $rating) { $this->id = $id; $this->rating = $rating; } public function increaseRating(RatingCost $cost) { $this->rating->increase($cost); } } class Rating { private int $value; public function __construct(int $value) { $this->value = $value; } public function increase(RatingCost $cost) { $this->value += $cost->getValue(); } } class RatingCost { private $value; public function __construct(int $value) { $this->value = $value; } public function getValue() : int { return $this->value; } } class VotePoll { public function __invoke(string $pollId, string $userId, string $pointId) { //$poll = $em->getPoll($pollId); $cost = new RatingCost(30); $firstPoint = new PollingPoint('firstPoint', 'Подписыюсь'); $secondPoint = new PollingPoint('secondPoint', 'За русь ем закусь'); $poll = new Poll([$firstPoint, $secondPoint], $cost); //$user = $em->getUser($userId); $rating = new Rating(1488); $user = new User('firstUser', $rating); $vote = new Vote($user, $firstPoint); $poll->vote($vote); //$em->flush(); return $user; } } print_r((new VotePoll)('pollId', 'userId', 'pointId'));

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.4.120.0090.00422.55
8.4.110.0110.01322.42
8.4.100.0080.00118.39
8.4.90.0120.00819.00
8.4.80.0120.00822.39
8.4.70.0080.00417.68
8.4.60.0080.01118.69
8.4.50.0120.01018.71
8.4.40.0080.01219.28
8.4.30.0160.00420.28
8.4.20.0070.01517.98
8.4.10.0030.00617.92
8.3.250.0100.00819.04
8.3.240.0090.01017.07
8.3.230.0140.00616.64
8.3.220.0110.00818.98
8.3.210.0100.00616.50
8.3.200.0060.00416.64
8.3.190.0110.00717.41
8.3.180.0130.00719.05
8.3.170.0070.01319.18
8.3.160.0150.00016.90
8.3.150.0130.00717.34
8.3.140.0050.00320.66
8.3.130.0060.00318.61
8.3.120.0110.00720.68
8.3.110.0100.00020.94
8.3.100.0040.00424.06
8.3.90.0000.00826.77
8.3.80.0060.00316.63
8.3.70.0040.01516.63
8.3.60.0070.00716.75
8.3.50.0100.01124.60
8.3.40.0120.00619.21
8.3.30.0090.00918.58
8.3.20.0000.00721.75
8.3.10.0040.00421.98
8.3.00.0000.00823.41
8.2.290.0050.00420.61
8.2.280.0150.00720.33
8.2.270.0110.00816.56
8.2.260.0130.00717.19
8.2.250.0050.00318.41
8.2.240.0160.00018.73
8.2.230.0090.00022.58
8.2.220.0040.00437.54
8.2.210.0120.00326.77
8.2.200.0040.00818.29
8.2.190.0040.01116.58
8.2.180.0090.00925.92
8.2.170.0090.00922.96
8.2.160.0110.00420.36
8.2.150.0000.00724.18
8.2.140.0030.00524.66
8.2.130.0050.00326.16
8.2.120.0080.00019.83
8.2.110.0100.01022.11
8.2.100.0040.00817.84
8.2.90.0080.00019.13
8.2.80.0000.00817.97
8.2.70.0060.00318.05
8.2.60.0040.00418.03
8.2.50.0040.00418.10
8.2.40.0080.00021.16
8.2.30.0040.00418.07
8.2.20.0040.00418.13
8.2.10.0070.00019.54
8.2.00.0000.00719.48
8.1.330.0100.01121.91
8.1.320.0100.00917.92
8.1.310.0170.00017.00
8.1.300.0060.00318.05
8.1.290.0030.00618.88
8.1.280.0070.00725.92
8.1.270.0090.00022.32
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0070.00322.50
8.1.230.0040.00817.82
8.1.220.0060.00317.74
8.1.210.0030.00918.77
8.1.200.0060.00317.38
8.1.190.0050.00517.35
8.1.180.0060.00318.10
8.1.170.0060.00318.57
8.1.160.0000.00718.81
8.1.150.0040.00418.81
8.1.140.0070.00018.81
8.1.130.0060.00320.16
8.1.120.0030.00317.57
8.1.110.0080.00017.40
8.1.100.0040.00417.44
8.1.90.0070.00017.54
8.1.80.0060.00317.50
8.1.70.0000.00717.49
8.1.60.0040.00417.54
8.1.50.0030.00517.50
8.1.40.0000.00817.45
8.1.30.0000.00817.62
8.1.20.0000.00917.72
8.1.10.0040.00417.50
8.1.00.0050.00317.56
8.0.300.0080.00018.77
8.0.290.0000.00816.75
8.0.280.0070.00018.39
8.0.270.0050.00318.14
8.0.260.0000.00720.11
8.0.250.0080.00017.09
8.0.240.0040.00417.14
8.0.230.0050.00317.07
8.0.220.0030.00317.06
8.0.210.0040.00416.88
8.0.200.0000.00717.06
8.0.190.0040.00416.97
8.0.180.0000.00816.95
8.0.170.0090.00016.91
8.0.160.0040.00417.01
8.0.150.0000.00716.96
8.0.140.0040.00416.86
8.0.130.0030.00313.43
8.0.120.0000.00816.98
8.0.110.0070.00017.00
8.0.100.0040.00416.80
8.0.90.0000.00917.02
8.0.80.0110.00817.03
8.0.70.0000.00817.03
8.0.60.0030.00516.81
8.0.50.0040.00417.05
8.0.30.0030.01717.02
8.0.20.0110.00817.39
8.0.10.0080.00017.16
8.0.00.0150.00316.88
7.4.330.0050.00015.55
7.4.320.0030.00316.65
7.4.300.0040.00416.64
7.4.290.0000.00716.64
7.4.280.0060.00316.57
7.4.270.0000.00716.55
7.4.260.0030.00313.32
7.4.250.0000.00816.38
7.4.240.0000.00716.62
7.4.230.0000.00716.59
7.4.220.0030.00316.55
7.4.210.0100.00816.56
7.4.200.0050.00216.68
7.4.130.0070.01216.54
7.4.120.0140.00516.50
7.4.110.0070.01116.53
7.4.100.0060.01216.57
7.4.90.0030.01316.62
7.4.80.0040.01419.39
7.4.70.0120.00316.61
7.4.60.0060.01116.57
7.4.50.0060.00616.62
7.4.40.0170.00516.51
7.4.30.0060.01716.50
7.4.20.0120.00816.39
7.4.10.0160.00316.46
7.4.00.0130.01016.70
7.3.330.0040.00416.10
7.3.320.0030.00312.97
7.3.310.0040.00416.11
7.3.300.0060.00016.19
7.3.290.0040.01216.20
7.3.280.0190.00316.14
7.3.260.0070.01116.39
7.3.240.0090.00816.26
7.3.230.0070.01616.09
7.3.210.0110.00616.19
7.3.200.0100.00716.15
7.3.190.0050.01116.24
7.3.180.0100.00716.28
7.3.170.0090.00616.20
7.3.160.0140.00416.37
7.3.150.0060.01216.36
7.3.140.0090.00916.34
7.3.130.0120.00616.27
7.3.120.0070.01216.35
7.3.110.0040.01816.12
7.3.100.0160.00616.00
7.3.90.0030.01716.36
7.3.80.0080.01116.07
7.3.70.0190.00416.22
7.3.60.0150.00716.02
7.3.50.0100.00916.16
7.3.40.0100.01016.07
7.3.30.0060.01216.13
7.3.20.0110.00716.03
7.3.10.0120.00916.18
7.3.00.0200.01016.15
7.2.330.0070.01016.30
7.2.320.0120.00916.37
7.2.310.0120.00916.25
7.2.300.0210.00316.48
7.2.290.0150.00916.17
7.2.280.0030.01816.23
7.2.270.0060.01316.23
7.2.260.0180.00316.46
7.2.250.0070.01316.36
7.2.240.0150.00616.47
7.2.230.0070.01316.30
7.2.220.0060.01616.15
7.2.210.0110.01216.34
7.2.200.0040.01616.28
7.2.190.0100.01516.26
7.2.180.0200.00316.38
7.2.170.0070.01616.30
7.2.160.0050.01316.28
7.2.150.0030.01916.33
7.2.140.0100.01316.45
7.2.130.0160.00616.26
7.2.120.0160.00616.36
7.2.110.0090.01216.52
7.2.100.0100.01316.27
7.2.90.0110.01516.22
7.2.80.0120.00916.34
7.2.70.0130.00616.20
7.2.60.0090.01216.21
7.2.50.0110.00816.07
7.2.40.0100.01016.38
7.2.30.0060.01916.18
7.2.20.0070.01716.43
7.2.10.0120.01216.37
7.2.00.0120.00916.30

preferences:
29.08 ms | 403 KiB | 5 Q