3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { private static int $a = 6; private static function foo(): int { return 5; } public function run(): void { var_dump($this->foo()); var_dump($this::foo()); var_dump(static::foo()); echo "\n-----------\n"; var_dump($this::$a); var_dump(static::$a); echo "\n-----------\n"; $other = new static(); var_dump($other->foo()); var_dump($other::foo()); } } class B extends A { public static string $a = 'b'; public static function foo(): string { return "a"; } } (new B)->run();

preferences:
60.82 ms | 796 KiB | 5 Q