3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private const string PREFIX = "Hello, "; private static string $prefix = "Hello, "; private static function prefix(): string { return "Hello, "; } public function greetFunc(string $to): string { return static::prefix() . $to . "!"; // passes, but insecure } public function greetVar(string $to): string { return static::$prefix . $to . "!"; // passes, but insecure } public function greetConst(string $to): string { return static::PREFIX . $to . "!"; // crashes immediately } } class Bar extends Foo { } echo (new Bar())->greetFunc("World") . PHP_EOL; echo (new Bar())->greetVar("World") . PHP_EOL; // echo (new Bar())->greetConst("World") . PHP_EOL; // Error! Referencing undefined Bar::PREFIX... class Buz extends Foo { protected const string PREFIX = "Hi, "; protected static string $prefix = "Hi, "; protected static function prefix(): string { return "Hi, "; } } echo (new Buz())->greetFunc("World") . PHP_EOL; // No! private function was overridden!! echo (new Buz())->greetVar("World") . PHP_EOL; // No! private property was overridden!! echo (new Buz())->greetConst("World") . PHP_EOL; // No! private const was overridden!!

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.30.0040.00419.45
8.5.20.0080.00918.73
8.5.10.0120.00718.25
8.5.00.0210.00817.18
8.4.180.0130.01021.90
8.4.170.0150.00724.01
8.4.160.0120.01223.11
8.4.150.0300.01219.68
8.4.140.0350.00717.59
8.4.130.0370.00517.63
8.4.120.0360.01017.89
8.4.110.0400.00517.59
8.4.100.0360.00817.80
8.4.90.0380.00717.52
8.4.80.0360.00817.77
8.4.70.0350.00817.96
8.4.60.0360.00917.92
8.4.50.0390.01017.73
8.4.40.0380.01017.52
8.4.30.0400.00717.55
8.4.20.0420.00717.54
8.4.10.0400.00817.52
8.3.300.0110.00820.85
8.3.290.0100.01120.83
8.3.280.0340.00818.31
8.3.270.0360.01017.18
8.3.260.0340.01017.18
8.3.250.0340.00817.18
8.3.240.0400.00617.18
8.3.230.0410.00417.18
8.3.220.0350.00817.18
8.3.210.0380.00617.18
8.3.200.0320.01017.18
8.3.190.0350.01017.18
8.3.180.0340.00917.18
8.3.170.0360.01017.18
8.3.160.0400.00817.18
8.3.150.0340.01317.18
8.3.140.0350.01017.18
8.3.130.0330.00817.18
8.3.120.0320.01017.18
8.3.110.0310.00817.18
8.3.100.0370.01217.18
8.3.90.0410.00917.18
8.3.80.0380.01017.18
8.3.70.0400.00517.18
8.3.60.0370.00917.18
8.3.50.0360.00917.18
8.3.40.0390.00518.02
8.3.30.0250.01117.87
8.3.20.0270.01017.98
8.3.10.0250.01117.97
8.3.00.0220.00917.82
8.2.300.0110.00917.94
8.2.290.0280.01017.18
8.2.280.0280.00817.18
8.2.270.0300.00917.18
8.2.260.0280.01017.18
8.2.250.0310.01117.18
8.2.240.0330.00817.18
8.2.230.0300.01017.18
8.2.220.0300.00817.18
8.2.210.0310.00717.18
8.2.200.0310.00717.18
8.2.190.0260.01217.18
8.2.180.0300.00717.18
8.2.170.0270.00917.87
8.2.160.0300.01017.72
8.2.150.0270.01017.82
8.2.140.0270.00917.61
8.2.130.0260.01017.76
8.2.120.0260.01117.66
8.2.110.0280.00817.82
8.2.100.0260.00917.69
8.2.90.0260.00917.84
8.2.80.0280.00717.79
8.2.70.0250.00917.78
8.2.60.0300.00717.84
8.2.50.0290.00717.85
8.2.40.0280.00817.36
8.2.30.0320.00417.56
8.2.20.0290.00717.73
8.2.10.0280.00817.58
8.2.00.0110.00517.73
8.1.340.0160.00517.79

preferences:
31 ms | 475 KiB | 5 Q