Gruppenarray PHP nach Schlüssel

  private function group_by($array, $key) {
      $return = array();
      
      foreach($array as $val) {
          $return[$val->$key][] = $val; 
	  //  ou para gettype($val) = array
	  //  $return[$val[$key]][] = $val; 
      }
      return $return;
  }
kaueholt