As title suggests, My question is that how i can convert a php class to an associative array? For example I've
class MyObject {
  private $size = null;
  private $length = null;
  private $width = null;
    public function getSize(){
        return $this->size;
    }
    public function setSize($size){
        $this->size = $size;
    }
    public function getLength(){
        return $this->length;
    }
    public function setLength($length){
        $this->length = $length;
    }
    public function getWidth(){
        return $this->width;
    }
    public function setWidth($width){
        $this->width = $width;
    }
}
//Now what i want is following
$abc = new MyObject();
$abc->width = 10;
$anArray = someFunction($abc);  
//This should generate an associative array
//Now associative array is accessible
echo $anArray['width]; // 10