3v4l.org

run code in 300+ PHP versions simultaneously
<?php // parent class class Vehicle { // private property name private $name; // public function start public function start() { echo $this->name. " - Engine start...<br/>"; } // public function stop public function stop() { echo $this->name. " - Engine stop...<br/>"; } } // child class class Car extends Vehicle { public function drive() { // accessing name variable of Car class echo "I am " . $this->name . "<br/>"; echo "Lets go on a drive..."; } } $car = new Car(); $car->name = "Mercedes benz"; var_dump($car);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Car::$name is deprecated in /in/OieYm on line 32 object(Car)#1 (2) { ["name":"Vehicle":private]=> NULL ["name"]=> string(13) "Mercedes benz" }

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