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 self::prefix() . $to . "!"; // OK, but unnecessary LSB } public function greetVar(string $to): string { return self::$prefix . $to . "!"; // OK, but unnecessary LSB } public function greetConst(string $to): string { return static::PREFIX . $to . "!"; // It should be self::PREFIX. } } 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 static string $prefix = "Hi, "; protected static function prefix(): string { return "Hi, "; } } echo (new Buz())->greetFunc("World") . PHP_EOL; // No! private function was actually overridden!! echo (new Buz())->greetVar("World") . PHP_EOL; // No! private property was actually 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.0050.00319.55
8.5.20.0080.00818.65
8.5.10.0130.00618.32
8.5.00.0240.00617.18
8.4.180.0130.01319.58
8.4.170.0120.00923.96
8.4.160.0140.01023.05
8.4.150.0340.00719.65
8.4.140.0330.00917.53
8.4.130.0370.00617.58
8.4.120.0430.00517.86
8.4.110.0390.01017.80
8.4.100.0360.01217.80
8.4.90.0370.00717.68
8.4.80.0360.01217.91
8.4.70.0410.00917.61
8.4.60.0360.00817.85
8.4.50.0410.00617.64
8.4.40.0370.01017.28
8.4.30.0380.00817.45
8.4.20.0410.00617.72
8.4.10.0400.00717.59
8.3.300.0110.01020.77
8.3.290.0120.01020.77
8.3.280.0280.01218.26
8.3.270.0340.01117.18
8.3.260.0360.00817.18
8.3.250.0400.00317.18
8.3.240.0350.00717.18
8.3.230.0300.01217.18
8.3.220.0370.00517.18
8.3.210.0340.00917.18
8.3.200.0370.00717.18
8.3.190.0340.01017.18
8.3.180.0360.00717.18
8.3.170.0360.00817.18
8.3.160.0370.00817.18
8.3.150.0400.00917.18
8.3.140.0390.00917.18
8.3.130.0330.00817.18
8.3.120.0310.01117.18
8.3.110.0320.00817.18
8.3.100.0420.00817.18
8.3.90.0390.00917.18
8.3.80.0380.00917.18
8.3.70.0410.00917.18
8.3.60.0330.01317.18
8.3.50.0400.00617.18
8.3.40.0380.00617.93
8.3.30.0260.00917.73
8.3.20.0310.00417.95
8.3.10.0350.00318.00
8.3.00.0250.01017.98
8.2.300.0140.00818.07
8.2.290.0310.00517.18
8.2.280.0310.00517.18
8.2.270.0310.00717.18
8.2.260.0250.01317.18
8.2.250.0260.01217.18
8.2.240.0310.00717.18
8.2.230.0310.00717.18
8.2.220.0290.00917.18
8.2.210.0320.00617.18
8.2.200.0290.00917.18
8.2.190.0290.00917.18
8.2.180.0290.00917.18
8.2.170.0270.00918.01
8.2.160.0280.00818.02
8.2.150.0320.00917.61
8.2.140.0340.00617.71
8.2.130.0250.01217.64
8.2.120.0290.00717.70
8.2.110.0280.01017.79
8.2.100.0280.01017.64
8.2.90.0300.00617.77
8.2.80.0310.00917.67
8.2.70.0250.01017.82
8.2.60.0300.00917.55
8.2.50.0260.00917.53
8.2.40.0320.00417.63
8.2.30.0300.00617.59
8.2.20.0290.00617.71
8.2.10.0240.01117.51
8.2.00.0320.00917.78
8.1.340.0140.00517.41

preferences:
47.4 ms | 403 KiB | 5 Q