3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo{ public $age = ''; public $name = ''; public $barObj = ''; public function setAge($age){ $this->age = $age; } public function setName($name){ $this->name = $name; } public function getUsersPropertyInfo(Bar $objBar){ if($objBar instanceof Bar1) { $objBar->getCarInfo(); } return $objBar; } } class Bar{ public $carName = ''; public $drivingSpeed = ''; public function __construct() { $this->setCarName('Mercedes'); $this->setdrivingSpeed(300); } public function setCarName($carName){ $this->carName = $carName; } public function setdrivingSpeed($drivingSpeed){ $this->drivingSpeed = $drivingSpeed; } public function getCarInfo(){ return $this->carName.'>>'.$this->drivingSpeed; } } $objFoo = new Foo(); $objFoo->setAge(22); $objFoo->setName('babalu'); $barObj = new Bar(); $usersPropertyInfo = $objFoo->getUsersPropertyInfo($barObj); print_r($usersPropertyInfo->carName);
Output for rfc.property-hooks, git.master, git.master_jit
Mercedes

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:
43.12 ms | 1479 KiB | 4 Q