Source Code:
(back to article)
<?php class MyClass { /** * @var int */ private int $myProperty; public function __construct() { $this->myProperty = 0; } public function getMyProperty(): int { return $this->myProperty; } public function setMyProperty(int $value): void { $this->myProperty = $value; } } $object = new MyClass(); $propertyValue = $object->getMyProperty(); echo "The value of the myProperty is: " . $propertyValue;
Result:
Report an issue