The problem is that PHP 4 is pass by copy by default. If you can upgrade to php 5 do it, it will help a lot with complex objects
$a = new a() ;
$a->name = 'fred' ;
// This puts a copy into your array, so now you have two A objects
// one that is inside b, the other is your original
$b->as[] = $a ;
// This modifies the $a outside $b
$a->name = 'monster' ;
// This makes yet another copy of the object from $b
$acopy = $b->as[0] ;
// echos 'monster'
echo $a->name ;
// echos 'fred'
echo $acopy->name ;
The solution is to learn how to use the '&' operator which will pass by reference. So you want to do something like
$b->as[0] = & $a ;
Make sure and read up on it on php.net in the object documentation.