code: public function getArrayCopyRec()
      {
          $ret = array();
          $it  = $this->getIterator();
  
          while ($it->valid()) {
              if ($it->current() instanceof self) {
                  $ret[$it->key()] = $it->current()->getArrayCopyRec();
              } else {
                  $ret[$it->key()] = $it->current();
              }
  
              $it->next();
          }
  
          return $ret;
      }
docs: Returns the multi-dimensional array structure with all instances of
  ArrayObject transformed to standard PHP arrays
  
  @return array Flattened array