<?php
class A{
var $s;
function set($x){
$this->s = $x;
}
function get(){
return $this->s;
}
}
class B{
var $s;
function set($x){
$this->s = $x;
}
function get(){
return $this->s;
}
}
$all = array(new A, new B);
$A1 = $all[0];
$A1->set(120);
$B1 = $all[0];
echo $B1->get(); // 120