title: How do you create an array with custom indexes?
body: <p>For some reason I can't create an array with custom indexes in <code>Javascript</code> or <code>PHP</code>. I have searched on Google, but I can't find anything when searching on <em>creating array with custom indexes</em>. I could swear the code below was working before. So was the code below working before or am I doing something wrong? And if the code below was working before then what is the new way of creating an array with custom indexes?</p>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>&lt;?php
    $foo = ['bar' =&gt; 'baz'];    
  ?&gt;
  </code></pre>
  
  <blockquote>
    <p>Error: Array to string conversion</p>
  </blockquote>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>var foo = ['bar' =&gt; 'baz'];
  </code></pre>
  
  <blockquote>
    <p>Error:
    Uncaught SyntaxError: Unexpected string</p>
  </blockquote>