I have an array of variables that are passed to a constructor of a class. I want to convert this into an array of objects of a specific class.
What's the best way to do this?
E.g.
class Foo { public function __construct($a) {$this->a=$a;} }
print_r(mass_instantiate(array(1, 2, 3), 'Foo'));
// gives:
Array
(
[0] => Foo Object
(
[a] => 1
)
[1] => Foo Object
(
[a] => 2
)
[2] => Foo Object
(
[a] => 3
)
)