3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface PaymentGatewayInterface { public function pay(array $bill); public function processNotification($notification); } class Payment { protected $gateway; public function __construct(PaymentGatewayInteface $gateway) { $this->gateway = $gateway; } public function pay(array $bill) { return $this->gateway->pay($bill); } public function processNotification($notification) { return $this->gateway->processNotification($notification); } } class Paypal implements PaymentGatewayInterface { public function pay(array $bill) { } public function processNotification($notification) { } } $a = new Payment(new Paypal);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: Payment::__construct(): Argument #1 ($gateway) must be of type PaymentGatewayInteface, Paypal given, called in /in/UC65P on line 43 and defined in /in/UC65P:14 Stack trace: #0 /in/UC65P(43): Payment->__construct(Object(Paypal)) #1 {main} thrown in /in/UC65P on line 14
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:
51.15 ms | 401 KiB | 8 Q