PHP : 連想配列のvalueにオブジェクトを格納するパターン

<?php

class Person {
    public $name;
    public $age;
    
    public function __construct($name, $age){
        $this->name = $name;
        $this->age = $age;
    }
    
    public function introduce(){
        echo "Hi my name is " . $this->name . "\n";
    }
}

$people = [
              "person1" => new Person("Bob", 22),
              "person2" => new Person("mary", 30)
];

// Hi my name is Bob
// Hi my name is mary
foreach ($people as $person) {
    $person->introduce();
}
/* https://sunrise033.com/entry/hatena-blog-how-to-hierarchicalize-categories */