class Person { public $name; public $age; public $occupation; } $newPerson = new Person; $personData = [ "name" => "John Smith", "age" => 25, "occupation" => "Software Engineer" ]; Person::setPropertiesFromArray($newPerson, $personData); echo $newPerson->name; // Output: John SmithIn this code, we define a class called "Person" and create a new instance of it. We also define an array with pre-defined properties for the new person. Using the static "setPropertiesFromArray" method, we assign the values in the array to the corresponding properties of the new person object. It's important to note that the setPropertiesFromArray method doesn't come standard with PHP. It's commonly included in package libraries, such as Yii2, Laravel, and Symfony.