There is a code
class emp { public function __construct($sur, $nam, $pat, $age = 30) { $this->sur = $sur; $this->nam = $nam; $this->pat = $pat; $this->age = $age; } public function __toString() { return "{$this->sur} {$this->nam[0]}. {$this->pat[0]}."; } public function __get($index) { return $this->$index; } public $sur; public $nam; private $pat; }
Why is the first variable displayed normally, and the initials of the variables nam, pat displayed with question marks?