3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Model { protected $comments; public function __construct() { $this->comments = new class { public function count() { return rand(1, 20); } }; } } class CommentCount { private $count; public function __construct(int $count) { $this->count = $count; } public function getCount(): int { return $this->count; } } class Post extends Model { public function commentCount(): CommentCount { return new CommentCount($this->comments->count()); } } $post = new Post(); $commentCount = $post->commentCount(); var_dump($commentCount->getCount()); var_dump($commentCount->getCount()); var_dump($commentCount->getCount()); var_dump($commentCount->getCount()); var_dump($commentCount->getCount());

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)
7.4.50.0090.00616.49
7.4.40.0120.00616.59
7.4.30.0130.00316.65
7.4.20.0160.00816.51
7.4.10.0040.01316.47
7.4.00.0030.01416.53
7.3.170.0030.01216.30
7.3.160.0030.01316.48
7.3.150.0070.01016.50
7.3.140.0100.00616.37
7.3.130.0090.00916.34
7.3.120.0150.00316.29
7.3.110.0070.01116.22
7.3.100.0100.00616.21
7.3.90.0000.01616.34
7.3.80.0140.00316.13
7.3.70.0100.00716.24
7.3.60.0090.00816.21
7.3.50.0040.01216.28
7.3.40.0070.01016.22
7.3.30.0120.00416.24
7.3.20.0090.01216.46
7.3.10.0120.00916.40
7.3.00.0100.00716.35
7.2.290.0070.01116.70
7.2.280.0090.00916.48
7.2.270.0070.01016.75
7.2.260.0110.00616.63
7.2.250.0170.00016.23
7.2.240.0090.00916.45
7.2.230.0110.01116.61
7.2.220.0070.01016.77
7.2.210.0130.00916.38
7.2.200.0100.01316.62
7.2.190.0170.00016.51
7.2.180.0100.00716.72
7.2.170.0160.00316.55
7.2.160.0070.01016.55
7.2.150.0060.01016.80
7.2.140.0150.00616.86
7.2.130.0090.00916.66
7.2.120.0140.00316.77
7.2.110.0070.01016.45
7.2.100.0080.00816.71
7.2.90.0100.00716.68
7.2.80.0070.01016.61
7.2.70.0110.01116.93
7.2.60.0080.00816.69
7.2.50.0090.00816.75
7.2.40.0090.01216.55
7.2.30.0030.01916.54
7.2.20.0090.01316.57
7.2.10.0100.00916.61
7.2.00.0000.01716.52

preferences:
43.03 ms | 403 KiB | 5 Q