function common_items(&$vector) { // for compatibility, we don't use pass by reference //$keys = array_intersect_key(&$this->values, &$vector->values); $keys = array_intersect_key($this->values, $vector->values); if (count($keys) == 0) { return NULL; } $array_a = array(); $array_b = array(); foreach ($keys as $key => $value) { $array_a[] = $this->values[$key]; $array_b[] = $vector->values[$key]; } $subset = array(); $subset[] = Vector::wrap('RealVector', $array_a); $subset[] = Vector::wrap('RealVector', $array_b); return $subset; }