3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); /** * @template-covariant T */ final class Collection { /** * @param list<T> $items */ public function __construct( private array $items = [], ) { } /** * @template TValue * @param Closure(T, int): TValue $callback * @return Collection<TValue> */ public function map(Closure $callback): self { $mapped = []; foreach ($this->items as $key => $item) { $mapped[] = $callback($item, $key); } return new self($mapped); } } enum X: string { case CASE1 = 'case1'; case CASE2 = 'case2'; } (new Collection(['case1']))->map(X::from(...));

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.5.00.0110.00920.18
8.4.150.0030.00014.05
8.4.140.0170.00517.89
8.4.130.0110.01017.57
8.4.120.0160.00420.76
8.4.110.0110.01020.74
8.4.100.0130.00718.01
8.4.90.0110.01017.95
8.4.80.0050.00420.73
8.4.70.0050.00418.16
8.4.60.0150.00717.90
8.4.50.0150.00718.05
8.4.40.0200.00020.56
8.4.30.0140.00718.88
8.4.20.0090.01220.62
8.4.10.0130.00323.75
8.3.280.0140.00718.68
8.3.270.0120.00816.66
8.3.260.0110.00816.76
8.3.250.0090.01019.12
8.3.240.0130.00616.77
8.3.230.0120.00916.73
8.3.220.0030.00517.31
8.3.210.0030.00416.65
8.3.200.0130.00616.83
8.3.190.0060.00316.67
8.3.180.0130.00716.82
8.3.170.0110.00719.08
8.3.160.0090.00918.44
8.3.150.0070.00717.17
8.3.140.0110.00717.03
8.3.130.0050.00518.79
8.3.120.0090.00020.80
8.3.110.0040.00416.80
8.3.100.0110.00816.84
8.3.50.0060.00316.75
8.2.290.0110.00820.75
8.2.280.0110.00716.77
8.2.270.0040.01418.66
8.2.260.0070.01018.82
8.2.250.0080.00016.66
8.2.240.0090.00917.44
8.2.230.0030.00616.80
8.2.220.0040.00417.04
8.2.50.0090.00519.52
8.1.330.0100.00916.64
8.1.320.0070.01118.36
8.1.310.0030.00616.66
8.1.300.0130.00316.17

preferences:
84.72 ms | 403 KiB | 5 Q