If my memory serves me right I believe you can also instantiate the classes by reference, but this is best only at design time and not at run-time, and only best in php 4.3 or above.
$class1 =& new classa;
$class2 =& new classb;
See the implications of this at the zend.com webcast site under PHP5 intro.. the one where Zeev expands on the problems of objects in php4
But the usual is like so:
<?
// this is mine...
$his = new Automobile;
$his->make = "Ferrari";
$his->colour = "Black";
$his->shape = "Cigar";
// ...and this is yours
$hers = new Automobile;
$hers->make = "Porsche";
$hers->colour = "Silver";
$hers->shape = "Torpedo";
// hey...i can dream, can't i
// i feel like taking mine out for a spin
$his->start();
// speed limit? you must be joking!
$his->accelerate(180);
// joining me, are you?
$hers->start();
$hers->accelerate(150);
// oops...was that a speed trap?
$his->decelerate(80);
$hers->decelerate(80);
// busted!
$his->stop();
$hers->stop();
?>
Check your parenthesis on instantiating!
-E-