3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Account { private $accNumber; private $bal; private $branch; private $accOwner; function __construct($accNumber,$bal,$branch,$accOwner) { $this->accNumber = $accNumber; $this->bal = $bal; $this->branch = $branch; $this->accOwner = $accOwner; $this->accOwner->setAccount($this); } } class SavingsAccount extends Account { private $type = "SavingsAccount"; public function getTypeOfAccount() { return $this->$type; } } class CurrentAccount extends Account { private $type = "CurrentAccount"; public function getTypeOfAccount() { return $this->$type; } } class AccountHolder { private $name; private $age; private $mob; private $account; function __construct($name,$age,$mob) { $this->full = $name; $this->age = $age; $this->mob = $mob; } public function setAccount($account) { $this->account = $account; } } $person_1 = new AccountHolder("Nevil",29,933338787); $account_1 = new CurrentAccount(111111,77896.00,"Kaloor",$person_1); $person_2 = new AccountHolder("Chitra",23,9878787345); $account_2 = new SavingsAccount(222222,18765.00,"Edapally",$person_2); print_r($account_1); print_r($account_2); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property AccountHolder::$full is deprecated in /in/RS12c on line 52 Deprecated: Creation of dynamic property AccountHolder::$full is deprecated in /in/RS12c on line 52 CurrentAccount Object ( [accNumber:Account:private] => 111111 [bal:Account:private] => 77896 [branch:Account:private] => Kaloor [accOwner:Account:private] => AccountHolder Object ( [name:AccountHolder:private] => [age:AccountHolder:private] => 29 [mob:AccountHolder:private] => 933338787 [account:AccountHolder:private] => CurrentAccount Object *RECURSION* [full] => Nevil ) [type:CurrentAccount:private] => CurrentAccount ) SavingsAccount Object ( [accNumber:Account:private] => 222222 [bal:Account:private] => 18765 [branch:Account:private] => Edapally [accOwner:Account:private] => AccountHolder Object ( [name:AccountHolder:private] => [age:AccountHolder:private] => 23 [mob:AccountHolder:private] => 9878787345 [account:AccountHolder:private] => SavingsAccount Object *RECURSION* [full] => Chitra ) [type:SavingsAccount:private] => SavingsAccount )

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:
60.15 ms | 403 KiB | 8 Q