3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum Fruit { case APPLE; case ORANGE; case BANANA; } // Sample data foreach (["APPLE", "PEAR", "ORANGE", "LEMON", "BANANA", "STRAWBERRY"] as $fruit) { // Find matching fruit in all enum cases $fruits = Fruit::cases(); $matchingFruitIndex = array_search($fruit, array_column($fruits, "name")); // If found, eat it if ($matchingFruitIndex !== false) { $matchingFruit = $fruits[$matchingFruitIndex]; eatFruit($matchingFruit); } else { echo $fruit . " is not a valid Fruit\n"; } } function eatFruit(Fruit $fruit): void { if ($fruit === Fruit::APPLE) { echo "An apple a day keeps the doctor away\n"; } elseif ($fruit === Fruit::ORANGE) { echo "When life gives you oranges, make orange juice\n"; } elseif ($fruit === Fruit::BANANA) { echo "Banana for scale\n"; } }

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.0110.00920.50
8.4.110.0150.00619.12
8.4.100.0100.01017.92
8.4.90.0120.00820.57
8.4.80.0140.00618.91
8.4.70.0110.00820.68
8.4.60.0120.00717.88
8.4.50.0110.01117.65
8.4.40.0140.00717.71
8.4.30.0130.00720.07
8.4.20.0070.00717.82
8.4.10.0090.00017.93
8.3.250.0100.00918.68
8.3.240.0110.00916.57
8.3.230.0100.01016.62
8.3.220.0030.00619.05
8.3.210.0110.00916.64
8.3.200.0040.00516.80
8.3.190.0110.00817.18
8.3.180.0090.00916.64
8.3.170.0140.00416.89
8.3.160.0120.00618.16
8.3.150.0110.00720.55
8.3.140.0080.00016.54
8.3.130.0040.00417.35
8.3.120.0160.00320.68
8.3.110.0100.00020.94
8.3.100.0320.01637.54
8.3.90.0340.01337.54
8.3.80.0360.01337.54
8.3.70.0370.01237.54
8.3.60.0370.01037.54
8.3.50.0360.00937.54
8.3.40.0250.01137.54
8.3.30.0320.01037.54
8.3.20.0320.00431.60
8.3.10.0150.01331.60
8.3.00.0170.01131.60
8.2.290.0100.00820.62
8.2.280.0120.00718.65
8.2.270.0100.01017.55
8.2.260.0040.00418.52
8.2.250.0030.00616.52
8.2.240.0030.00617.55
8.2.230.0030.00622.58
8.2.220.0090.00637.54
8.2.210.0190.00837.54
8.2.200.0200.00037.54
8.2.190.0160.01037.54
8.2.180.0220.00737.54
8.2.170.0260.00337.54
8.2.160.0140.00737.54
8.2.150.0350.00631.60
8.2.140.0220.00831.60
8.2.130.0220.00731.60
8.2.120.0250.00831.60
8.2.110.0290.00731.60
8.2.100.0210.01231.60
8.2.90.0240.00231.60
8.2.80.0200.00531.60
8.2.70.0190.00831.60
8.2.60.0140.00631.60
8.2.50.0180.00631.60
8.2.40.0200.00431.60
8.2.30.0100.00931.60
8.2.20.0130.00431.60
8.2.10.0180.00631.60
8.2.00.0130.00931.60
8.1.330.0140.00421.81
8.1.320.0100.00916.24
8.1.310.0040.00416.86
8.1.300.0060.00319.92
8.1.290.0210.00037.54
8.1.280.0150.00637.54
8.1.270.0100.00731.60
8.1.260.0150.00531.60
8.1.250.0110.00931.60
8.1.240.0120.00931.60
8.1.230.0190.00631.60
8.1.220.0070.01131.60
8.1.210.0220.00331.60
8.1.200.0120.01031.60
8.1.190.0120.00424.36
8.1.180.0140.00731.60
8.1.170.0160.00431.60
8.1.160.0200.00331.60
8.1.150.0170.00631.60
8.1.140.0150.00731.60
8.1.130.0110.00831.60
8.1.120.0060.00520.79
8.1.110.0160.00431.60
8.1.100.0110.00424.51
8.1.90.0090.01331.60
8.1.80.0110.00931.60
8.1.70.0130.00631.60
8.1.60.0240.00131.60
8.1.50.0170.00231.60
8.1.40.0090.00731.60
8.1.30.0170.00631.60
8.1.20.0180.00431.60
8.1.10.0120.00623.13
8.1.00.0120.00826.84
8.0.300.0160.00331.60
8.0.290.0130.00931.60
8.0.280.0180.00431.60
8.0.270.0150.00231.60
8.0.260.0150.00631.60
8.0.250.0160.00331.60
8.0.240.0130.00731.60
8.0.230.0160.00531.60
8.0.220.0070.01131.60
8.0.210.0210.00631.60
8.0.200.0200.00631.60
8.0.190.0220.00731.60
8.0.180.0180.00931.60
8.0.170.0220.00931.60
8.0.160.0160.00931.60
8.0.150.0240.00531.60
8.0.140.0210.00326.65
8.0.130.0220.00526.61
8.0.120.0220.00626.63
8.0.110.0170.00726.64
8.0.100.0200.00826.66
8.0.90.0200.00526.68
8.0.80.0170.00926.62
8.0.70.0220.00326.63
8.0.60.0190.00926.63
8.0.50.0210.00726.68
8.0.30.0180.00726.65
8.0.20.0160.00926.71
8.0.10.0200.00726.69
7.4.330.0260.00431.60
7.4.320.0270.00631.60
7.4.300.0280.00631.60
7.4.290.0290.00531.60
7.4.280.0280.00731.60
7.4.270.0230.00726.49
7.4.260.0260.00526.51
7.4.250.0230.00726.53
7.4.240.0260.00426.53
7.4.230.0250.00626.51
7.4.220.0140.01026.54
7.4.210.0190.00426.53
7.4.200.0170.00526.54
7.4.190.0180.00426.57
7.4.180.0170.00726.52
7.4.160.0180.00726.58
7.4.150.0200.00426.51
7.4.140.0120.01126.48
7.4.130.0140.00526.47
7.4.120.0180.00726.46
7.4.110.0180.00526.46
7.4.100.0110.00826.52
7.4.90.0150.00326.50
7.4.80.0130.00826.45
7.4.70.0150.00526.49
7.4.60.0160.00626.47
7.4.50.0110.01126.40
7.4.40.0220.00226.41
7.4.30.0230.00326.45
7.4.20.0180.01026.49
7.4.10.0180.00526.47
7.4.00.0190.00526.50

preferences:
27.73 ms | 403 KiB | 5 Q