3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Event { private $propagationStopped = false; public function isPropagationStopped() { return $this->propagationStopped; } public function stopPropagation() { $this->propagationStopped = true; } } class AddFranchiseeEvent extends Event { const EVENT_ID = 'gtt.franchisee_my.event.add_franchisee'; private $franchisee; private $prefix; private $code; private $clientId; public function __construct(Franchisee $franchisee, $prefix, $code, $clientId) { $this->franchisee = $franchisee; $this->prefix = $prefix; $this->code = $code; $this->clientId = $clientId; } public function getFranchisee() { return $this->franchisee; } public function getPrefix() { return $this->prefix; } public function getCode() { return $this->code; } public function getClientId() { return $this->clientId; } } class Franchisee { private $id; private $parentId; private $shortName; private $fullName; private $branchId; private $status; public function setStatus($status) { $this->status = $status; } public function getStatus() { return $this->status; } public function setFullName($fullName) { $this->fullName = $fullName; } public function getFullName() { return $this->fullName; } public function setId($id) { $this->id = $id; } public function getId() { return $this->id; } public function setParentId($parentId) { $this->parentId = $parentId; } public function getParentId() { return $this->parentId; } public function setShortName($shortName) { $this->shortName = $shortName; } public function getShortName() { return $this->shortName; } public function getBranchId() { return $this->branchId; } public function setBranchId($branchId) { $this->branchId = $branchId; } } $object = new AddFranchiseeEvent(new Franchisee(), 'pref', 121, 12323); echo json_encode($object);

preferences:
53.06 ms | 402 KiB | 5 Q