Вот что получилось:
Первый класс
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?PHP
- use PDO;
- class
- {
- public function __construct(...$arrUserInfo)
- {
- $config = [
- 'host' => 'localhost',
- 'name' => 'users',
- 'user' => 'root',
- 'password' => '',
- ];
- $this->db = new PDO(
- 'mysql:host=' . $config['host'] . ';dbname=' . $config['name'] . '',
- $config['user'],
- $config['password']
- );
- [$this->id] = $arrUserInfo;
- $this->list = $this->userListJson();
- }
- [$name, $surname, $dateOfBirth, $gender, $cityOfBirth, $id] = $arrUserInfo;
- $this->name = $name;
- $this->surname = $surname;
- $this->dateOfBirth = $dateOfBirth;
- $this->gender = $gender;
- $this->cityOfBirth = $cityOfBirth;
- }
- }