Here is the code:

$user = VK::getUser($userID); $this->id = $user->id; // $this - объект того же класса, что и $user $this->name = $user->name; // и так далее... 
  • And what does the clone design not please you with? - Dmitriy Simushev
  • I do not understand how to use it in this situation - Mikhail Tikhonov
  • Since $this an object of the same class as $user , then you need to clone $user at a higher level and only then work with it. Although you need to be sure that cloning works correctly on objects of type $user . - Dmitriy Simushev
  • $ this = clone ($ user); ??? - Mikhail Tikhonov
  • Firstly, clone is not a function, and secondly, this action should be carried out at a higher level (and not in the scope of the class methods). - Dmitriy Simushev

0