Solution Review: Magic Method
Let's look at the solution of the Magic Method challenge.
We'll cover the following...
Solution
Press + to interact
<?phpclass User {private $firstName;private $lastName;public function __construct($firstName,$lastName) {$this -> firstName = $firstName;$this -> lastName = $lastName;}public function getFullName() {return $this -> firstName . ' ' . $this -> lastName;}}function test(){$user1 = new User("John", "Doe");return $user1 -> getFullName();}echo test();?>