3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface OwnerInterface { public function setData($data); public function getOwnerId($name); public function getOwner($ownerId); } interface AssetInterface { public function setData($data); public function getAssetId($ownerId); public function getAsset($assetId); } class Asset implements AssetInterface, OwnerInterface { protected $assetId; // string or int? DB autogen? protected $assetType; // string protected $assetSubType; protected $ownerId; // protected $owner; // object protected $beneficiary; // string public function setData($data) { } public function getAssetId($ownerId) { } public function getAsset($assetId) { return $this; } public function getAssetType($assetId) { } public function getAssetSubType($assetId) { } public function getOwnerId($name) { } public function getOwner($ownerId) { return $this->owner; // Owner object; I don't think this is the owner object } public function setAssetId($assetId) { } public function setAsset($assetId) { } public function setAssetType($assetId) { } public function setAssetSubType($assetId, $subType) { $this->assetSubType=$subType; } public function setOwnerId($ownerId) { } } ////////////////////////////////////////////////////////// $asset=new Asset(); $assetId="A0001"; $assetType="BUILDING"; $assetSubType="Gas Station"; $ownerId="Current Owner Id"; $asset->$assetId=$assetId; // string or int? DB autogen? $asset->$assetType=$assetType; // string $asset->$ownerId=$ownerId; // $asset->$assetSubType=$assetSubType; // string var_dump($asset);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Asset::$A0001 is deprecated in /in/okgta on line 95 Deprecated: Creation of dynamic property Asset::$BUILDING is deprecated in /in/okgta on line 96 Deprecated: Creation of dynamic property Asset::$Current Owner Id is deprecated in /in/okgta on line 97 Deprecated: Creation of dynamic property Asset::$Gas Station is deprecated in /in/okgta on line 99 object(Asset)#1 (10) { ["assetId":protected]=> NULL ["assetType":protected]=> NULL ["assetSubType":protected]=> NULL ["ownerId":protected]=> NULL ["owner":protected]=> NULL ["beneficiary":protected]=> NULL ["A0001"]=> string(5) "A0001" ["BUILDING"]=> string(8) "BUILDING" ["Current Owner Id"]=> string(16) "Current Owner Id" ["Gas Station"]=> string(11) "Gas Station" }

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.38 ms | 402 KiB | 8 Q