Model, Factory, Utils; then run closure require_once __DIR__ . '/model/Person.php'; require_once __DIR__ . '/factory/personFactory.php'; require_once __DIR__ . '/utils/func.php'; // Entry point (function() { $persons = makePersons(); // make demo persons echo "==> To beging I will print the data generated by the Person Factory.\n"; // first print sayHelloToAll($persons); // display hello message echo "\n==> Now I will edit some data with magic method...\n"; // edit some data $persons[0]->lastname = 'New Last Name Very Long LMAO'; $persons[3]->lastname = 'An Other Very Long Last Name'; $persons[4]->lastname = 'An New FirstName'; sayHelloToAll($persons); // display hello message echo "\n==> Now I will edit the age and show it with magic methods...\n"; // edit age, reboot lastname and display $persons[0]->lastname = 'Nihart'; echo "BEFORE: " . $persons[0]->getFormattedName() . " & age=" . $persons[0]->age . "\n"; $persons[0]->age = 10; echo "AFTER: " . $persons[0]->getFormattedName() . " & age=" . $persons[0]->age . "\n"; $persons[0]->age = -20; echo "AFTER 2 WITH NO EFFECT: " . $persons[0]->getFormattedName() . " & age=" . $persons[0]->age . "\n"; } )();