$val) { switch(true) { case is_object($val): $out[$key] = $this->obj2array($val); break; case is_array($val): $out[$key] = $this->obj2array($val); break; default: $out[$key] = $val; } } return $out; } }