3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); /** * @template T */ class Example { /** @param T $inner */ public function __construct(public mixed $inner) { } /** * @return T */ public function get(): mixed { return $this->inner; } /** * @template U * @param callable(T): U $callback * @return U */ public function map(callable $callback): mixed { return $callback($this->inner); } /** * @template U * @param callable(T): U $callback * @return Example<U> */ public function chainMap(callable $callback): Example { return new self($callback($this->inner)); } } $example = new Example(123); // phpstorm understands this as int|mixed $value = $example->get(); // phpstorm understands this as int|mixed $value = $example->map(fn (int $val): string => (string) $val); function requiresInt(int $input) { } // phpstorm still sees this more crazy one as int|mixed.. $value = $example->chainMap(fn ($val) => (string) $val) ->chainMap(fn ($val) => new Example($val)) ->chainMap(fn ($val) => new Example($val)) ->chainMap(fn ($val) => $val->get()->get()) ->get(); // but psalm understands // psalm: InvalidScalarArgument: Argument 1 of requiresInt expects int, "123" provided requiresInt($value);

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.20.0120.00719.36
8.5.10.0110.00717.07
8.5.00.0120.00920.23
8.4.170.0140.00823.89
8.4.160.0100.01223.88
8.4.150.0030.00014.05
8.4.140.0080.01317.73
8.4.130.0090.01117.96
8.4.120.0040.00520.58
8.4.110.0120.00622.70
8.4.100.0100.01117.73
8.4.90.0050.00418.18
8.4.80.0050.00418.13
8.4.70.0160.00518.04
8.4.60.0100.01120.32
8.4.50.0150.00717.84
8.4.40.0100.00618.01
8.4.30.0060.01320.48
8.4.20.0140.00718.19
8.4.10.0080.00417.80
8.3.300.0110.01120.82
8.3.290.0100.01020.96
8.3.280.0120.00818.62
8.3.270.0120.01016.85
8.3.260.0120.00716.84
8.3.250.0130.00619.00
8.3.240.0040.00416.87
8.3.230.0110.00316.91
8.3.220.0100.00517.08
8.3.210.0120.00616.77
8.3.200.0100.01016.76
8.3.190.0080.01017.16
8.3.180.0100.00916.83
8.3.170.0120.00016.57
8.3.160.0100.01018.66
8.3.150.0100.01017.07
8.3.140.0110.00720.62
8.3.130.0110.00418.64
8.3.120.0030.00618.84
8.3.110.0050.00520.94
8.3.100.0090.00624.06
8.3.90.0060.01326.77
8.3.80.0000.00916.88
8.3.70.0130.00316.63
8.3.60.0060.00916.63
8.3.50.0100.00719.74
8.3.40.0080.00818.59
8.3.30.0070.01018.80
8.3.20.0080.00024.18
8.3.10.0060.00324.66
8.3.00.0080.00026.16
8.2.300.0080.00218.69
8.2.290.0120.00720.18
8.2.280.0120.00818.78
8.2.270.0130.00617.05
8.2.260.0090.00019.32
8.2.250.0060.00318.66
8.2.240.0030.00616.98
8.2.230.0060.00322.58
8.2.220.0080.00037.54
8.2.210.0000.00826.77
8.2.200.0030.00616.75
8.2.190.0100.01018.29
8.2.180.0100.00725.92
8.2.170.0120.00318.89
8.2.160.0030.01022.96
8.2.150.0070.00025.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0050.00326.16
8.2.110.0050.00522.25
8.2.100.0070.00318.72
8.1.340.0110.00921.66
8.1.330.0070.00216.48
8.1.320.0050.00516.31
8.1.310.0110.00716.96
8.1.300.0090.00018.25
8.1.290.0060.00318.88
8.1.280.0040.01525.92
8.1.270.0080.00023.99
8.1.260.0090.00026.35
8.1.250.0050.00328.09
8.1.240.0080.00320.16
8.1.230.0030.00718.45

preferences:
29.07 ms | 403 KiB | 5 Q