3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private const string PREFIX = "Hello. "; private static string $prefix = "Hello, "; private function prefix(): string { return "Hello, "; } public function greetFunc(string $to): string { return static::prefix() . $to . "!"; // OK, but unnecessary LSB } public function greetVar(string $to): string { return static::$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 { } class Buz extends Foo { private static string $prefix = "Hi, "; private function prefix(): string { return "Hi, "; } } echo (new Bar())->greetFunc("World") . PHP_EOL; echo (new Bar())->greetVar("World") . PHP_EOL; // echo (new Bar())->greetConst("World") . PHP_EOL; // Referencing undefined Bar::PREFIX... // echo (new Buz())->greetFunc("World") . PHP_EOL; // Referencing private Buz::prefix() from Foo class // echo (new Buz())->greetVar("World") . PHP_EOL; // Referencing private Buz::$prefix from Foo class

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.00219.53
8.5.20.0110.00718.76
8.5.10.0120.01018.36
8.5.00.0230.00717.18
8.4.180.0160.00519.64
8.4.170.0120.01023.78
8.4.160.0080.01322.99
8.4.150.0320.00919.70
8.4.140.0320.00917.75
8.4.130.0340.00917.62
8.4.120.0390.00617.61
8.4.110.0380.00817.75
8.4.100.0350.01017.89
8.4.90.0400.00617.66
8.4.80.0390.00617.96
8.4.70.0360.00917.86
8.4.60.0360.00917.68
8.4.50.0360.00817.98
8.4.40.0370.01217.66
8.4.30.0420.00917.30
8.4.20.0380.01117.57
8.4.10.0360.01117.55
8.3.300.0180.00620.93
8.3.290.0090.01120.66
8.3.280.0350.00618.01
8.3.270.0350.01017.18
8.3.260.0350.00917.18
8.3.250.0340.01017.18
8.3.240.0360.00617.18
8.3.230.0330.01017.18
8.3.220.0360.00717.18
8.3.210.0390.00717.18
8.3.200.0410.00517.18
8.3.190.0370.00717.18
8.3.180.0340.00917.18
8.3.170.0330.00817.18
8.3.160.0350.01117.18
8.3.150.0370.01017.18
8.3.140.0430.00717.18
8.3.130.0350.00817.18
8.3.120.0300.01017.18
8.3.110.0350.00517.18
8.3.100.0360.00817.18
8.3.90.0350.01117.18
8.3.80.0400.00817.18
8.3.70.0340.01317.18
8.3.60.0380.00917.18
8.3.50.0400.00717.18
8.3.40.0380.00717.69
8.3.30.0300.00717.90
8.3.20.0290.00717.96
8.3.10.0270.00817.91
8.3.00.0290.01017.96
8.2.300.0130.01018.08
8.2.290.0250.01017.18
8.2.280.0270.00917.18
8.2.270.0310.00717.18
8.2.260.0290.00917.18
8.2.250.0250.01317.18
8.2.240.0300.00817.18
8.2.230.0310.00817.18
8.2.220.0320.00817.18
8.2.210.0280.01017.18
8.2.200.0290.00917.18
8.2.190.0280.01017.18
8.2.180.0300.00917.18
8.2.170.0290.01017.90
8.2.160.0290.00718.03
8.2.150.0270.01117.65
8.2.140.0360.00617.47
8.2.130.0290.00717.78
8.2.120.0340.00317.83
8.2.110.0310.00617.83
8.2.100.0290.00617.64
8.2.90.0260.00917.77
8.2.80.0270.00817.78
8.2.70.0280.00917.50
8.2.60.0270.00917.84
8.2.50.0310.00517.85
8.2.40.0280.00817.73
8.2.30.0290.00917.72
8.2.20.0300.00517.55
8.2.10.0290.00917.59
8.2.00.0350.00817.57
8.1.340.0140.00717.66

preferences:
33.82 ms | 403 KiB | 5 Q