Source Code:
(back to article)
<?php class User { public $name; public function getName() { return $this->name; } } $user = new User(); $user->name = 'John'; echo $user->getName(); // Outputs 'John'
Result:
Report an issue