To answer your exact question, yes, using arrays is fine. You could use something like SplObjectStorage instead, but for most use-cases, an array is quite fine...
I would do this differently. Instead of creating the object inside the method, I'd pass the object in:
public function receiver(Person $person) {
$this->receiver[] = $person;
}
Then calling with:
$person = new Person();
$person->email = '[email protected]';
$obj->receiver($person);
That way, you're decoupling the implementation of the Person object from the current object (whetever it is). Even better would be to declare an interface depending on how you expect it to work for that usage, and require an implementation of that interface:
interface iEmailable {
public function getName();
public function getEmail();
}
class Person implements iEmailable {
protected $name = '';
protected $email = '';
public function __construct($name, $email) {
$this->name = $name;
$this->email = $email;
}
public function getName() {
return $this->name;
}
public function getEmail() {
return $this->email;
}
}
then, adjust your method to:
public function receiver(iEmailable $person) {
$this->receiver[] = $person;
}
Now, you're much more decoupled from the concrete Person class. Any class is free to be passed in, as long as it implements the proper interface...