title: PHP: Access Array Value on the Fly
body: <p>In php, I often need to map a variable using an array ... but I can not seem to be able to do this in a one liner. c.f. example:</p>
  
  <pre><code>// the following results in an error:
  echo array('a','b','c')[$key];
  
  // this works, using an unnecessary variable:
  $variable = array('a','b','c');
  echo $variable[$key];
  </code></pre>
  
  <p>This is a minor problem, but it keeps bugging every once in a while ... I don't like the fact, that I use a variable for nothing ;)</p>