There is a class file class.employee.php
<?php class employee { public function __construct($surname, $name, $patronymic, $age = 18) { $this->surname = $surname; $this->name = $name; $this->patronymic = $patronymic; $this->age = $age; } public function __toString() { return "{$this->surname} {$this->name[0]}.{$this->patronymic[0]}."; } public function __get($index) { return $this->$index; } public $surname; public $name; private $patronymic; } ?>
have it used
<!DOCTYPE html> <html lang="ru"> <head> <title>index</title> <meta charset="utf-8" /> </head> <body> <?php require_once("class.employee.php"); $obj = new employee("Борисов", "Игорь", "Иванович"); echo "Сотрудник $obj недавно принят на работу"; ?> </body>
but where initials should be displayed, question marks are displayed instead of letters
Both files are stored in utf-8 without BOM.
What is the problem and how to solve it?