3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Car { protected $speed = 0; protected $people = 0; public function onboardPerson() { $this->people++; } public function accelerate() { $this->speed++; } } class Taxi extends Car { protected $fare; public function setFare($fare) { $this->fare = $fare; } } $taxi = new Taxi(); // Replace instances of type Car (T) with subtype Taxi (S) $taxi->onboardPerson(); $taxi->accelerate(); var_dump($taxi);
Output for git.master, git.master_jit, rfc.property-hooks
object(Taxi)#1 (3) { ["speed":protected]=> int(1) ["people":protected]=> int(1) ["fare":protected]=> NULL }

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:
59.36 ms | 401 KiB | 8 Q