title: Avoid large switch statement in frontcontroller
body: <p>I have a larger application with a Frontcontroller in php that handles incoming ajax requests. I am thinking about a good way to handle Action->Method mapping, this controller is in charge of instantiating other classes and executing methods there.</p>
  
  <p>The switch is just getting too big and it's ugly. I was thinking about creating an array and simply doing:</p>
  
  <pre><code>if(in_array($action, $methodmap)){
    $methodmap[$action]();
  }    
  </code></pre>
  
  <p>But not sure of how efficient that would be or if there are any other better alternatives, performance is important since this controller handles a whole lot of incoming requests.</p>
  
  <p>Thanks!</p>