title: PHP how to get value from array if key is in a variable
body: <p>I have a key stored in a variable like so:</p>
  
  <pre><code>$key = 4;
  </code></pre>
  
  <p>I tried to get the relevant value like so:</p>
  
  <pre><code>$value = $array[$key];
  </code></pre>
  
  <p>but it failed. Help.</p>