3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface A { public function foo(string $s): string; public function bar(int $i): int; } // Абстрактный класс может реализовывать только часть интерфейса. // Классы, расширяющие абстрактный класс, должны реализовать все остальные. abstract class B implements A { public function foo(string $s): string { return $s . PHP_EOL; } } class C extends B { public function bar(int $i): int { return $i * 2; } } $c = new C(); echo $c->bar(2); // OK, 4 $b = new B(); $b->foo("123");
Output for git.master, git.master_jit, rfc.literals
4 Fatal error: Uncaught Error: Cannot instantiate abstract class B in /in/nSJIF:31 Stack trace: #0 {main} thrown in /in/nSJIF on line 31
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
49.22 ms | 459 KiB | 5 Q