title: Convert a PHP class name to an index
body: <p>I have an array of namespaced classes</p>
  
  <pre><code>$modules = [
   Namespace\Folder\Module1::class
   Namespace\Folder\Module2::class
   Namespace\Folder\Module3::class
  ];
  </code></pre>
  
  <p>I want to be able to convert the class name into a unique index to be used and stored. </p>
  
  <pre><code>foreach($modules as $module) { 
    $index = someCleverFunctionHere($module);
  }
  </code></pre>
  
  <p>I don't want to use md5 as that's too long.  I looked into using CRC32... and then decided against it.   I will be adding some text to the end of index and storing it in a table (the column is a length of 62 char), so the smaller the index is, the better.  </p>
  
  <p>$index could be alphanumberic or numeric.  </p>
  
  <p>I did think about doing a split on the class name and then building an index array </p>
  
  <pre><code>$indexArray = [
  'a' =&gt; 'Namespace',
  'b' =&gt; 'Folder',
  'c' =&gt; 'Module1',
  'd' =&gt; 'Module2',
  ];
  </code></pre>
  
  <p>Which would create an index for <code>Namespace\Folder\Module1::class</code>  as "abcc".</p>
  
  <p>Is this the right approach?  If so what would be the best (and most efficient) way to convert the classname into the index?  If not... what do you suggest? </p>
  
  <p>TIA.</p>