title: Array (or associative array) with user-specified dimensions
body: <p>I'm trying to think about the appropriate data structure for storing grammatical paradigms. I want something like an associative array, but with an arbitrary number of dimensions. In a simple case, it's easy to think of the data structure. If the two dimensions of the paradigm are as follows...</p>
  
  <p><strong>Gender (Masculine, Feminine, Neuter)</strong></p>
  
  <p><strong>Case (Nominative, Accusative, Dative, Genitive)</strong></p>
  
  <p>... then it makes sense to use a hash map in C++, or an associative array in PHP:</p>
  
  <pre><code>$value['Masculine']['Accusative'] = 'foo';
  $value['Neuter']['Dative'] = 'foo';
  </code></pre>
  
  <p>The problem is that, for a given language, any number of ‘dimensions’ might be important. (There is surely an upper bound, but I don't know what that is in advance.) I want the user to specify what the important values are, and to be able to change them dynamically as well.</p>
  
  <p>Is there any sort of data structure that has that flexibility, or would I need to create my own with a special class, or something like that?</p>