Mah ...

Codice PHP:
$i 5;
$array[$i] = new B();