3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum PaymentMethods : string { case PAYPAL = 'pay with paypal'; case STRIPE = 'pay with stripe'; public static function fromName(string $method): PaymentMethods { foreach(PaymentMethods::cases() as $case) { if ($case->name === $method) { return $case; } } return null; } } $method= "PAYPAL"; var_dump(PaymentMethods::fromName($method));

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.0120.00520.52
8.4.110.0100.01118.53
8.4.100.0090.01117.78
8.4.90.0050.00417.92
8.4.80.0100.00920.56
8.4.70.0080.00217.73
8.4.60.0120.00718.05
8.4.50.0090.01317.68
8.4.40.0060.01324.03
8.4.30.0080.00018.60
8.4.20.0090.00917.96
8.4.10.0030.00523.94
8.3.250.0120.00618.70
8.3.240.0040.00816.59
8.3.230.0140.00316.41
8.3.220.0120.00617.01
8.3.210.0090.01016.75
8.3.200.0130.00616.74
8.3.190.0140.00616.67
8.3.180.0090.00616.54
8.3.170.0110.00717.18
8.3.160.0070.00316.49
8.3.150.0100.01020.60
8.3.140.0040.00420.71
8.3.130.0050.00318.16
8.3.120.0030.00618.93
8.3.110.0130.00716.46
8.3.100.0040.01518.21
8.3.50.0170.00316.38
8.2.290.0090.00620.30
8.2.280.0060.00216.80
8.2.270.0100.00716.94
8.2.260.0110.00717.25
8.2.250.0040.00416.68
8.2.240.0070.01118.87
8.2.230.0090.00616.41
8.2.220.0070.00316.69
8.2.30.0060.00621.12
8.1.330.0110.00716.76
8.1.320.0110.00816.06
8.1.310.0150.00316.60
8.1.300.0030.00617.61
8.1.280.0170.00617.97

preferences:
25.47 ms | 403 KiB | 5 Q