title: Why do I have to load a PHP array to a variable before fetching an element?
body: <p>Why do I have to load a PHP array into a variable before I access its elements?</p>
  
  <p>Why can't I access the elements directly from the result of a function call?</p>
  
  <p>e.g. This works:</p>
  
  <pre><code>$foo = "This is a variable I'm going to split/explode";
  $bar = explode(' ', $foo);
  echo $bar[1];
  </code></pre>
  
  <p>But this doesn't:</p>
  
  <pre><code>$foo = "This is a variable I'm going to split/explode";
  echo explode(' ', $foo)[1];
  </code></pre>