3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function getKey() { return 1; } }; class Bar { function getId() { return 2; } }; class Repo { function getItems($id) { return ['got' => $id]; } } class Test { private Repo $repository; function __construct() { $this->repository = new Repo(); } function foo(Foo|Bar $obj): array { return $this->repository->getItems( match ($obj::class) { Foo::class => $obj->getKey(), Bar::class=> $obj->getId(), } ); } }; $obj = new Foo(); $test = new Test(); var_dump($test->foo($obj));

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.10.0100.00916.70
8.5.00.0130.00920.04
8.4.150.0020.00114.05
8.4.140.0110.01117.65
8.4.130.0140.00218.72
8.4.120.0130.00724.01
8.4.110.0080.01220.77
8.4.100.0110.01018.67
8.4.90.0060.01220.70
8.4.80.0110.00918.67
8.4.70.0060.00518.81
8.4.60.0130.00718.57
8.4.50.0060.00418.79
8.4.40.0130.00717.68
8.4.30.0050.00318.84
8.4.20.0030.00618.97
8.4.10.0040.00419.63
8.3.280.0130.00818.51
8.3.270.0160.00616.46
8.3.260.0090.00816.80
8.3.250.0120.00618.96
8.3.240.0100.00917.05
8.3.230.0090.00716.45
8.3.220.0120.00818.73
8.3.210.0140.00616.52
8.3.200.0060.00216.70
8.3.190.0130.00518.88
8.3.180.0110.00418.93
8.3.170.0090.00916.74
8.3.160.0070.01118.81
8.3.150.0150.00316.54
8.3.140.0100.00019.07
8.3.130.0040.00418.38
8.3.120.0030.00619.09
8.3.110.0090.00020.94
8.3.100.0030.00624.06
8.3.90.0000.00826.77
8.3.80.0070.00417.97
8.3.70.0100.01318.50
8.3.60.0150.00618.55
8.3.50.0110.00416.57
8.3.40.0140.00020.46
8.3.30.0140.00420.39
8.3.20.0050.00324.18
8.3.10.0040.00424.66
8.3.00.0160.00318.77
8.2.290.0070.00320.31
8.2.280.0110.00818.53
8.2.270.0060.00616.71
8.2.260.0140.00416.73
8.2.250.0000.00816.69
8.2.240.0060.00319.02
8.2.230.0000.00822.58
8.2.220.0090.00637.54
8.2.210.0000.00826.77
8.2.200.0120.00016.75
8.2.190.0070.00718.54
8.2.180.0120.00916.75
8.2.170.0120.00319.09
8.2.160.0030.01322.96
8.2.150.0080.00025.66
8.2.140.0030.00524.66
8.2.130.0110.00719.34
8.2.120.0120.00619.04
8.2.110.0160.00318.91
8.2.100.0070.01119.01
8.2.90.0090.00919.00
8.2.80.0150.00418.95
8.2.70.0070.01118.72
8.2.60.0120.00318.89
8.2.50.0170.00318.80
8.2.40.0110.00418.78
8.2.30.0100.01018.83
8.2.20.0030.01318.79
8.2.10.0000.00818.79
8.2.00.0090.00018.83
8.1.330.0090.01022.07
8.1.320.0130.00718.38
8.1.310.0060.00316.31
8.1.300.0120.00318.64
8.1.290.0090.00030.84
8.1.280.0140.00325.92
8.1.270.0060.00322.05
8.1.260.0150.00322.00
8.1.250.0000.01822.18
8.1.240.0150.00418.58
8.1.230.0090.00918.57
8.1.220.0000.01518.70
8.1.210.0060.00318.54
8.1.200.0040.00418.59
8.1.190.0080.00018.71
8.1.180.0040.00418.35
8.1.170.0000.00918.53
8.1.160.0040.00418.48
8.1.150.0040.00418.47
8.1.140.0000.00818.53
8.1.130.0050.00318.86
8.1.120.0060.00318.41
8.1.110.0080.00018.56
8.1.100.0060.00318.55
8.1.90.0060.00318.54
8.1.80.0030.00518.63
8.1.70.0030.00618.63
8.1.60.0040.00418.80
8.1.50.0050.00318.64
8.1.40.0050.00318.72
8.1.30.0050.00318.73
8.1.20.0060.00318.75
8.1.10.0100.00018.74
8.1.00.0060.00318.53

preferences:
34.25 ms | 403 KiB | 5 Q