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);

preferences:
72.04 ms | 404 KiB | 5 Q